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
IF
Post Prodigy
Post Prodigy

dax calculation with specific need

Hi, I am working on a power bi file which is loaded to : https://we.tl/t-dD2O8stykY I have 4 filters; city, region, town and month selection. The results are correct for city, region and month.

What i want is that I don't want to see any value if I select value from TownName. The card should be empty (not blank).

Can you help me on this?

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @IF 
Modify your formula for :

TypeA = if(SELECTEDVALUE('CityTable'[CityName])= blank(),
SWITCH(min(Main[_Flag_1]),
        1,Calculate(SUM(Main[Value1]),Main[_Flag_2]=1),
        2,Calculate(SUM(Main[Value1]),Main[_Flag_2] = 2,Main[City]="#",Main[Town]="#"),
        3,Calculate(SUM(Main[Value1]),Main[_Flag_2] = 3),
        4,Calculate(SUM(Main[Value1]),Main[_Flag_2] = 4),
        BLANK()),"")
result :
Ritaf1983_0-1697718486714.png
if you need also to hide the category label
you can create Dax measure :
flagA = if('Main'[TypeA]="",1,0)
and base of it makes the label white with conditional formatting:
Ritaf1983_1-1697718916513.png

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @IF 
Modify your formula for :

TypeA = if(SELECTEDVALUE('CityTable'[CityName])= blank(),
SWITCH(min(Main[_Flag_1]),
        1,Calculate(SUM(Main[Value1]),Main[_Flag_2]=1),
        2,Calculate(SUM(Main[Value1]),Main[_Flag_2] = 2,Main[City]="#",Main[Town]="#"),
        3,Calculate(SUM(Main[Value1]),Main[_Flag_2] = 3),
        4,Calculate(SUM(Main[Value1]),Main[_Flag_2] = 4),
        BLANK()),"")
result :
Ritaf1983_0-1697718486714.png
if you need also to hide the category label
you can create Dax measure :
flagA = if('Main'[TypeA]="",1,0)
and base of it makes the label white with conditional formatting:
Ritaf1983_1-1697718916513.png

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors