Forum Discussion

TomaKavi's avatar
TomaKavi
Icon for Helper I rankHelper I
4 years ago
Solved

Switch not showing correct result

Hello guys, 
I have a problem and I am desperate. The below DAX is not showing proper result. If i hard code it and replace [SR1100 Total test] with lets say ,,10000,, it works, shows 10000 in the specific row and other figures are measured properly as [Total Value]. But If I leave the [SR1100 Total test] it will show 0 (its becasue the  [Total Value] was defined to show 0 if its blank.

This measure is simple [SR1100 Total test]  =
CALCULATE (
[Total Value],
Total_2021[Consolidation account]
IN {
"V10000",
"V20000",
"V30000"
}
)

Switch Values =
VAR CurrentItem = SELECTEDVALUE( Conso_Temp[Description - Normalized] )

RETURN
SWITCH( TRUE(),
CurrentItem = "Operating profit or loss (+/-)", [SR1100 Total test],
CALCULATE( [Total Value], FILTER( Conso_Temp,Conso_Temp[Description - Normalized] = CurrentItem )))
 
as you can see it shows 0 but should be (lets say 143900) the Value above is correct.
 
Table where I show these result is connected to Fact Table where the ,,Total Value,, are counted. I also need to filter it via country a loop up table which has direct connection to Fact table. I use the SWITCH in a Table vizual which is take from Conso Temp. 

 Any ideas why I cant see what I need? 

 
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi TomaKavi 

    I am so glad to hear that your problem has been solved , please consider Accept it as the solution to help the other members find it more quickly. 

     

    Best Regards,
    Community Support Team _ Ailsa Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Try changing the measure to

    [SR1100 Total test]  =
    CALCULATE (
    [Total Value],
    Total_2021[Consolidation account]
    IN {
    "V10000",
    "V20000",
    "V30000"
    },
    REMOVEFILTERS(Conso_Temp[Description - Normalized])
    )
  • actually I have added into the
    SR1100=

    CALCULATE (
    [Total Value],

    Allselected (),All() Total_2021[Consolidation account]........ works now

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi TomaKavi 

    I am so glad to hear that your problem has been solved , please consider Accept it as the solution to help the other members find it more quickly. 

     

    Best Regards,
    Community Support Team _ Ailsa Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.