Forum Discussion

joshua1990's avatar
joshua1990
Post Prodigy
3 years ago
Solved

Switch between Currency and Number

Hi all!

I have a report where I would like to put a switch on top as a slicer to switch between currency and units.

For this objective I started with this approach:

SWITCH A = 
VAR _Selection = SELECTEDVALUE('Currency/ Volume'[ID])
VAR _Volume = FORMAT(DIVIDE(SUM('Sales'[Value 1]),1000), "#,##K")
VAR _Dollar = FORMAT(DIVIDE(SUM('Sales'[Value 1 $]),1000), "$ #,##K")

RETURN
IF(_Selection = 1, _Dollar, _Volume) 

 

I have an unrelated table with 2 columns

Dimension ID
Currency 1
Volumne 2

 

Based on the selection of ID (1 or 2), I switch within the measure to Units or Dollars.

But now I get a Text Format as a result in the matrix. I would still like to have a number column in the matrix in the end with all values on the right alligned.

 

Any thoughts / optimizations on the approach above?

How would you do it?

8 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi  ,

    I would do this with a calculation group:

    Expression:selectedmeasure()

    Format string expression:

    IF(SELECTEDVALUE('Selection for V/C'[value]="Currency", "$ #,##K", selectedmeasureformatstring())

     



     

    joshua1990