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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.