Forum Discussion
Change custom format string based on slicer from another table
Hi everyone,
I encounter some issue with applying custom format string dynamically based on slicer from another table:
I have a slicer based on table 1 as below
Measure 1
Measure 2
When I click on Measure Name 1 (from table 1), then Measure 1 from table 2 would be used in my charts. And when I click on Measure Name 2, Measure 2 from table 2 would be used.
Since the two measures are different in amount I have created the following calculation (in table 1) to swithc custom format string to change unit of amount as below:
Format String =
VAR _CurrentValue =
if('Measure'[Measure Name]="Measure Name 1",SUM(Measure 1),SUM(Measure 2))
VAR _NumberFormat =
SWITCH (
TRUE (),
_CurrentValue <= 1E3, "#,0.",
_CurrentValue <= 1E4, "#,0,.0K",
_CurrentValue <= 1E5, "#,0,.0K",
_CurrentValue <= 1E6, "#,0,.0K",
_CurrentValue <= 1E7, "#,0,,.M",
_CurrentValue <= 1E9, "#,0,,.M",
_CurrentValue <= 1E20, "#,0,,.M"
)
VAR _FormatString =
_NumberFormat
RETURN
_FormatString
For a while it was working fine. Also the unit changed according to the filter applied on dashboard. But now it is always using Measure 1, or the Measure selected when applying format string, to decide measure unit and filter doesn't impact the unit.
I have tried creating Format string in table 2 but the result is the same.
I wonder is there a way to fix this or is there an alternative to do this other than creating 2 different tabs using the 2 measures? 😞
1 Reply
- Ritaf1983Super User
Hi Read39487
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly