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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Filter with measure

I want to filter values "2024" and "FFR", so i write a measure and the put this on filter panel

I wrote thise measure

FilterCamp = IF(FILTER(VALUES(M_Agg[CodZef]),M_Agg[CodZef]="2024"),1,0)

and it works

but if i write
FilterCamp = IF(FILTER(VALUES(M_Agg[CodZef]),M_Agg[CodZef]="FFR"),1,0)


it returns me this error
"

Cannot Convert value of type text to type true false"

why? i want to filter these two values, not only 2024

thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Would you like to check if there are any rows in the M_Agg table where the CodZef value is equal to 2024 or FFR? If such rows exist, the measure will return 1; otherwise, it will return 0.

 

I’ve made a test and encountered the same issue you mentioned. You could try to use countrows instead as @PowerNewUser  mentioned, that is a good solution.

 

Here I have another idea in mind, and I would like to share it for reference.

1\My table

vbofengmsft_3-1725592420263.png

 

2\My measure

 

FilterCampFor2024 = If(IsBlank(CALCULATE(COUNT(M_Agg[CodZef]),M_Agg[CodZef]="2024")),0,1)

 

FilterCampForFFR = If(IsBlank(CALCULATE(COUNT(M_Agg[CodZef]),M_Agg[CodZef]="FFR")),0,1)
 

3\Result

vbofengmsft_4-1725592458839.png

 

Best Regards,

Bof

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Would you like to check if there are any rows in the M_Agg table where the CodZef value is equal to 2024 or FFR? If such rows exist, the measure will return 1; otherwise, it will return 0.

 

I’ve made a test and encountered the same issue you mentioned. You could try to use countrows instead as @PowerNewUser  mentioned, that is a good solution.

 

Here I have another idea in mind, and I would like to share it for reference.

1\My table

vbofengmsft_3-1725592420263.png

 

2\My measure

 

FilterCampFor2024 = If(IsBlank(CALCULATE(COUNT(M_Agg[CodZef]),M_Agg[CodZef]="2024")),0,1)

 

FilterCampForFFR = If(IsBlank(CALCULATE(COUNT(M_Agg[CodZef]),M_Agg[CodZef]="FFR")),0,1)
 

3\Result

vbofengmsft_4-1725592458839.png

 

Best Regards,

Bof

 

 

PowerNewUser
Resolver I
Resolver I

filter is supposed to return a table... maybe wrap it in a countrows and check if >0?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.