Forum Discussion

IF's avatar
IF
Icon for Post Prodigy rankPost Prodigy
2 years ago
Solved

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?

  • 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 :
    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:

     

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

1 Reply

  • 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 :
    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:

     

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly