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,
My goal is to get a count of maximum available values in slicer (I've made a filter measure of COUNTROWS(RELATEDTABLE(FACT) and put it as a filter greater or equal to 1 for the slicer, so it captures only date available in fact table) and compare it with the current values choosen in the slicers. Then, depending on how many I'll make a switch statement with certain behaviours like
-Not selected anything - "Please select period"
-Everything selected - "All period selected (" & MaxSelectionCount & ")"
-Up to 5 selections - I have concat with MonthYear values
-Above 5 selections - Above 5 periods selected (" & Count & ")"
So far I've tried only with Not selected and Everything Selected, If I got those right then I'll be set and rest is easy
VAR _Selection =
ISFILTERED ( ' date'[MonthYear] )
VAR _Count =
COUNTROWS ( VALUES ( ' date'[MonthYear] ) )
VAR _MaxSelectionCount =
CALCULATE (
COUNTROWS ( ' date' ),
REMOVEFILTERS ( ' date'[MonthYear] ),
RELATEDTABLE ( ' FACT' )
)
VAR _Result =
SWITCH (
TRUE (),
Selection = FALSE (), "Please select period to review",
Count = MaxSelectionCount,
"All period selected (" & MaxSelectionCount & ")"
)
RETURN
Result
It is because it gives me 9, instead of 7 available values in slicer
Try removing "REMOVEFILTERS ( ' date'[MonthYear] ),". It's better if you could share your file/data
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.
User | Count |
---|---|
110 | |
78 | |
66 | |
52 | |
51 |
User | Count |
---|---|
127 | |
116 | |
78 | |
64 | |
63 |