Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
joshua1990
Post Prodigy
Post Prodigy

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?

1 ACCEPTED SOLUTION

@joshua1990 

Sure, 

Here is an example file





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
ValtteriN
Super User
Super User

Hi  ,

I would do this with a calculation group:

Expression:selectedmeasure()

Format string expression:

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

 

ValtteriN_0-1685283573161.png

ValtteriN_3-1685283953684.pngValtteriN_4-1685283966175.png

 

@joshua1990





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ValtteriN : Thanks a lot! Could you please share the Power BI File as well?

@joshua1990 

Sure, 

Here is an example file





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ValtteriN :Thanks for sharing. Is it possible to use the same approach to switch between a Volume and a Dollar column with the indidivudal format? As of now it changing just the format for a single column, right?

@ValtteriN : Thanks a lot for providing this. It seems like the same column is display once in units and once in dollars, right?

But what I need is something the also multiplies the units into a dollar value. I have a column with units, I have a column with the price per unit and then if needed I have a calculated column with the total dollars (units x price)

@ValtteriN THanks a lot! Any workourant without Tabular Editor? I am not allowed to use this software.

@joshua1990  you can also manage calculation groups in Visual studio or after the upcoming release announced at MS Build calculation groups will be available in Power BI desktop. I think this was scheduled for June's release.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




joshua1990
Post Prodigy
Post Prodigy

No ideas?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.