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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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