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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
cristianml
Post Prodigy
Post Prodigy

Filter in measure is not applying

Hi,

For some reason the filters is not applying on the visual:

'00_CALENDAR'[Current XTD]=

 

cristianml_0-1666377823983.png

 

 

 

Testing:

Filter not applied:

cristianml_1-1666377895346.png

 

 

 

Filter applied:

cristianml_2-1666377940196.png

 

 

Any idea why the filters in the measure is not doing what is expected to do ?

 

Thanks!

1 ACCEPTED SOLUTION
cristianml
Post Prodigy
Post Prodigy

I solved this issue creating another measure using the filters again :

 

cristianml_0-1666707613662.png

 

 

-Visual 2 (Card) (Var %) Switch =
 
VAR _Period = SELECTEDVALUE(Period[Period])

VAR _PTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current PTD]="PTD")
VAR _MTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current MTD]="MTD")
VAR _QTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current QTD]="QTD")
VAR _YTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current YTD]="YTD")

RETURN

SWITCH(_Period,
"MTD",_MTD,
"PTD",_PTD,
"QTD",_QTD,
"YTD",_YTD)
 
The issue is that sometimes is not applying the filters due to the order of the variables. I learned that if you create the variables with the filters before the calculation it works.

View solution in original post

2 REPLIES 2
cristianml
Post Prodigy
Post Prodigy

I solved this issue creating another measure using the filters again :

 

cristianml_0-1666707613662.png

 

 

-Visual 2 (Card) (Var %) Switch =
 
VAR _Period = SELECTEDVALUE(Period[Period])

VAR _PTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current PTD]="PTD")
VAR _MTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current MTD]="MTD")
VAR _QTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current QTD]="QTD")
VAR _YTD = CALCULATE('PTO - MM-ME'[-Visual 2 (Card) (Var %)],'00_CALENDAR'[Current YTD]="YTD")

RETURN

SWITCH(_Period,
"MTD",_MTD,
"PTD",_PTD,
"QTD",_QTD,
"YTD",_YTD)
 
The issue is that sometimes is not applying the filters due to the order of the variables. I learned that if you create the variables with the filters before the calculation it works.
lbendlin
Super User
Super User

Have you considered using Field Parameters or Calculation Groups for this scenario?

 

Examine your data model, especially the search filter directions.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors