Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hello,
Apologies that I don't have good sample data for this question. If this doesn't make sense I'll try to simplify.
I would like to add an IF statement to filter on an existing Measure so that only 1 row in my visual is filtered
Example: I need to add an IF FILTER only on the Vascular Surgery Row
2019 | 2020 | 2021 | |
VAD | 20 | 60 | 100 |
Heart | 30 | 70 | 101 |
Valve | 40 | 80 | 102 |
Vascular Surgery | 50 | 90 | 103 |
Here is the Existing Measure:
CountByRank =
VAR res =
CALCULATE (
COUNT ( 'All Data'[Procedure_Desc] ),
FILTER ( 'All Data', 'All Data'[LowestRank] = 1 ),
ALLEXCEPT ( 'All Data', 'All Data'[Service Date] )
)
RETURN
IF ( ISBLANK ( res ), 0, res )
Here is the IF statement I need to add to the above measure.
IF ('All Data', 'All Data'[Provider Groups] = "Vascular Surgery")
FILTER('ProcedureList', 'ProcedureList'[Service] = "Vascular Surgery")
Not sure how/where this new statement should fit in with the original.
Thanks for any assistance!
Solved! Go to Solution.
I found a solution to this today
1. Created a Metric to Calculate everything exept Vascular Surgery
2. Created a Metric to Calculate Vascular Surgery Filtering only by the Provider group
3. Created a Metric to Total 1 & 2
I found a solution to this today
1. Created a Metric to Calculate everything exept Vascular Surgery
2. Created a Metric to Calculate Vascular Surgery Filtering only by the Provider group
3. Created a Metric to Total 1 & 2
Hi @adoster, it depends on what your model looks like as I can see you have at least two tables (All Data and ProcedureList).
It might be possible to solve it with a calculated column. Your IF statement isn't valid, but it looks like you want to exclude all other values except the "Vascular Surgery" service for the "Vascular Surgery" provider group only? If so, you may be able to use a calculated column like this:
Include in Count Flag =
IF(
'All Data'[Provider Groups] = "Vascular Surgery"
&& RELATED('ProcedureList'[Service]) = "Vascular Surgery"
|| NOT 'All Data'[Provider Groups] = "Vascular Surgery"
, 1
, 0
)
CountByRank =
VAR res =
CALCULATE (
COUNT ( 'All Data'[Procedure_Desc] ),
FILTER ( 'All Data', 'All Data'[LowestRank] = 1 ),
ALLEXCEPT ( 'All Data', 'All Data'[Service Date] ),
'All Data'[Include in Count Flag] = 1
)
RETURN
IF ( ISBLANK ( res ), 0, res )