Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Pbiuserr
Post Prodigy
Post Prodigy

How to create such measure for a card

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

 

Pbiuserr_0-1678294620386.png

 

 

1 REPLY 1
YukiK
Impactful Individual
Impactful Individual

Try removing "REMOVEFILTERS ( ' date'[MonthYear] ),". It's better if you could share your file/data

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.