FINAL PROJECT -TASK 6-POWER BI
When we are creating the dynamic measures for SalesAmountSelectedCurrency , we have used different variables for each currency and returned them through IF statements as seen in the following code:
SalesAmountSelectedCurrency =
var SalesAmount = SUm(fact_InternetSales[SalesAmount])
var USDdollor = CALCULATE(SalesAmount,dim_Currency[CurrencyAlternateKey]="USD")
var AUD = CALCULATE(SalesAmount,dim_Currency[CurrencyAlternateKey]="AUD")
var CAD = CALCULATE(SalesAmount,dim_Currency[CurrencyAlternateKey]="CAD")
var DEM = CALCULATE(SalesAmount,dim_Currency[CurrencyAlternateKey]="DEM")
var FRF = CALCULATE(SalesAmount,dim_Currency[CurrencyAlternateKey]="FRF")
var GBP = CALCULATE(SalesAmount,dim_Currency[CurrencyAlternateKey]="GBP")
RETURN
IF(SELECTEDVALUE(dim_Currency[CurrencyAlternateKey])="USD",USDdollor,
IF(SELECTEDVALUE(dim_Currency[CurrencyAlternateKey])="AUD",AUD,
IF(SELECTEDVALUE(dim_Currency[CurrencyAlternateKey])="CAD",CAD,
IF(SELECTEDVALUE(dim_Currency[CurrencyAlternateKey])="DEM",DEM,
IF(SELECTEDVALUE(dim_Currency[CurrencyAlternateKey])="FRF",FRF,
IF(SELECTEDVALUE(dim_Currency[CurrencyAlternateKey])="GBP",GBP,
"No Currency Selected "))))))
But when we have created the dynamic measure for title bar , it is seen that only a single variable using ISFILTERED and VALUES is written as follows :
Titlebar =
var CurrencySelected =
IF(ISFILTERED(dim_Currency[CurrencyAlternateKey]),VALUES(dim_Currency[CurrencyAlternateKey]),BLANK())
RETURN
IF(ISFILTERED(dim_Currency[CurrencyAlternateKey]),"Sales Amount in " & CurrencySelected & " vs ALL currencies ","Please select a currency")
Thus , Can you explain the usage / working of ISFILTERED and VALUES in detail , what it returns , what it checks for ?
1 answers ( 0 marked as helpful)
ISFILTERED returns a boolean expression if the slicer has been filtered, so if if the Currency Key is filtered, then show me the values. VALUES returns distinct values so in our case returns the selected value.