The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello Power BI Community
I have some trouble to figure out how to use Dax Isfiltered function.
This is my current meassure that calculate YoY expression. When you select categories is shows N/A and this works.
Now I also want to apply isfiltered to MM-YYYY aswell, all before year 2019 should show N/A and Year before works normally with YoY
The visual
The meassure:
Thanks you
Khanh Tu
Solved! Go to Solution.
Hey @Anonymous ,
if you want to check for a specific value, you should use the SELECTEDVALUE function.
So you can check if [Case_origin group] or if the selected year is 2019 and then return "N/A" or otherweise return the value:
YTD visual V/C Ratio =
VAR VC_Ratio =
DIVIDE(
[CV_TOTAL_VOLUME_YTD],
[YTD Total cases],
0
)
RETURN
IF(
ISFILTERED( SALESFORCE_CASES_FCT_20210429[Case_origin group] ) || SELECTEDVALUE( myDate[Year] ) = 2019,
"N/A",
VC_Ratio
)
Hey @Anonymous ,
you could use the "IN" operator:
YoY YTD V/C Ratio Visual =
VAR YoY_YTD_VC_Ratio = DIVIDE( [YTD V/C Ratio], [LY YTD V/C Ratio], 0 ) - 1
VAR YoY_YTD_VC_Ratio_visual =
IF(
ISFILTERED( SALESFORCE_CASES_FCT_20210429[Case_origin group] ) ||
SELECTEDVALUE( DIM_DATE[MM-YYYY] ) IN {
"12-2019",
"11-2019",
"10-2019",
"09-2019",
"08-2019",
"07-2019",
"06-2019",
"05-2019",
"04-2019",
"03-2019",
"02-2019",
"01-2019"
},
"N/A",
YoY_YTD_VC_Ratio
)
RETURN
YoY_YTD_VC_Ratio_visual
Or check for the year:
YoY YTD V/C Ratio Visual =
VAR YoY_YTD_VC_Ratio = DIVIDE( [YTD V/C Ratio], [LY YTD V/C Ratio], 0 ) - 1
VAR YoY_YTD_VC_Ratio_visual =
IF(
ISFILTERED( SALESFORCE_CASES_FCT_20210429[Case_origin group] ) ||
RIGHT( SELECTEDVALUE( DIM_DATE[MM-YYYY] ), 4 ) = "2019",
"N/A",
YoY_YTD_VC_Ratio
)
RETURN
YoY_YTD_VC_Ratio_visual
Try:
Proud to be a Super User!
Paul on Linkedin.
Hey @Anonymous ,
if you want to check for a specific value, you should use the SELECTEDVALUE function.
So you can check if [Case_origin group] or if the selected year is 2019 and then return "N/A" or otherweise return the value:
YTD visual V/C Ratio =
VAR VC_Ratio =
DIVIDE(
[CV_TOTAL_VOLUME_YTD],
[YTD Total cases],
0
)
RETURN
IF(
ISFILTERED( SALESFORCE_CASES_FCT_20210429[Case_origin group] ) || SELECTEDVALUE( myDate[Year] ) = 2019,
"N/A",
VC_Ratio
)
Thanks you @selimovd
Is there better way I can optimize my code, because im using a text column as my date x axis. I cannot use logical operator to filter in syntax.
This is my current code, i have to select all those 12 months
Best regards
Khanh
Hey @Anonymous ,
you could use the "IN" operator:
YoY YTD V/C Ratio Visual =
VAR YoY_YTD_VC_Ratio = DIVIDE( [YTD V/C Ratio], [LY YTD V/C Ratio], 0 ) - 1
VAR YoY_YTD_VC_Ratio_visual =
IF(
ISFILTERED( SALESFORCE_CASES_FCT_20210429[Case_origin group] ) ||
SELECTEDVALUE( DIM_DATE[MM-YYYY] ) IN {
"12-2019",
"11-2019",
"10-2019",
"09-2019",
"08-2019",
"07-2019",
"06-2019",
"05-2019",
"04-2019",
"03-2019",
"02-2019",
"01-2019"
},
"N/A",
YoY_YTD_VC_Ratio
)
RETURN
YoY_YTD_VC_Ratio_visual
Or check for the year:
YoY YTD V/C Ratio Visual =
VAR YoY_YTD_VC_Ratio = DIVIDE( [YTD V/C Ratio], [LY YTD V/C Ratio], 0 ) - 1
VAR YoY_YTD_VC_Ratio_visual =
IF(
ISFILTERED( SALESFORCE_CASES_FCT_20210429[Case_origin group] ) ||
RIGHT( SELECTEDVALUE( DIM_DATE[MM-YYYY] ), 4 ) = "2019",
"N/A",
YoY_YTD_VC_Ratio
)
RETURN
YoY_YTD_VC_Ratio_visual
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
111 | |
80 | |
78 | |
43 | |
37 |
User | Count |
---|---|
158 | |
111 | |
64 | |
59 | |
54 |