Forum Discussion
Formatting and results between two measures not consistent
- 1 year ago
1. Why the difference, when in essence, they seem like the same calculations?
The differences arise because of the different formatting rules applied to each measure. Measure1 is formatted to show decimals only, while Measure2 uses a SWITCH statement to dynamically format the result as either a percentage or a total, depending on the toggle selection. This can lead to rounding differences and inconsistencies in how the values are displayed.2. How do I get them to dynamically change in digits (both the matrix version and the one on the KPI card)?
To achieve consistent dynamic formatting for both measures, you can modify your DAX formulas to ensure they handle the formatting in a similar way. Here's a revised approach:Measure1 (KPI Card)
Measure1 =
VAR Result = SUMX(New_Cust) / SUMX(Total_Cust)
RETURN
IF(Result = 0, 0, FORMAT(Result, "0.####"))
Measure2 (Matrix)
Measure2 =
VAR Result = SUMX(New_Cust) / SUMX(Total_Cust)
RETURN
SWITCH(
TRUE,
SELECTVALUE('toggle'[toggle]) = "Percent" && Result = 0, "0%",
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.0001, FORMAT(Result, "0.000##%"),
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.001, FORMAT(Result, "0.00##%"),
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.01, FORMAT(Result, "0.0##%"),
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.1, FORMAT(Result, "0##%"),
SELECTVALUE('toggle'[toggle]) = "Total", FORMAT(SUMX(New_Cust), "##0"),
FORMAT(Result, "0.####")
)
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
1. Why the difference, when in essence, they seem like the same calculations?
The differences arise because of the different formatting rules applied to each measure. Measure1 is formatted to show decimals only, while Measure2 uses a SWITCH statement to dynamically format the result as either a percentage or a total, depending on the toggle selection. This can lead to rounding differences and inconsistencies in how the values are displayed.
2. How do I get them to dynamically change in digits (both the matrix version and the one on the KPI card)?
To achieve consistent dynamic formatting for both measures, you can modify your DAX formulas to ensure they handle the formatting in a similar way. Here's a revised approach:
Measure1 (KPI Card)
Measure1 =
VAR Result = SUMX(New_Cust) / SUMX(Total_Cust)
RETURN
IF(Result = 0, 0, FORMAT(Result, "0.####"))
Measure2 (Matrix)
Measure2 =
VAR Result = SUMX(New_Cust) / SUMX(Total_Cust)
RETURN
SWITCH(
TRUE,
SELECTVALUE('toggle'[toggle]) = "Percent" && Result = 0, "0%",
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.0001, FORMAT(Result, "0.000##%"),
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.001, FORMAT(Result, "0.00##%"),
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.01, FORMAT(Result, "0.0##%"),
SELECTVALUE('toggle'[toggle]) = "Percent" && Result < 0.1, FORMAT(Result, "0##%"),
SELECTVALUE('toggle'[toggle]) = "Total", FORMAT(SUMX(New_Cust), "##0"),
FORMAT(Result, "0.####")
)
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!