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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
peter_rips
Frequent Visitor

Switch Statement - units and values(currency symbol)

Hello there,

I've been using the following Switch statement measure to switch between Units and Sales Values on several parts of my report: 

 

NAT_U_S_Selector = 
SWITCH( TRUE(),
	VALUES('Selector'[Measure]) = "Units", Facts[NAT_SumU],
	VALUES('Selector'[Measure]) = "Value", CURRENCY(Facts[NAT_Sum_Sales]),
	BLANK())

So far so good, the switch works perfect switching from Units to Value, everywhere I need.

 

Problem is, the value doesn't come up with the currency symbol. (Even if it is formatted has currency - Image below)

Trying to solve this, I'm trying to force "currency" on the switch statement but ... no success.

 

Alternatively, if I change this (NAT_U_S_Selector) measure format to currency ... everything (Units and Value) will then display with the Currency Symbol, but this is not a solution since units are units and currency is currency.

1.png

 

 

2.png

 

 

Is there any tip to show the currency symbol, using a switch?

BTW, if I use the original Facts[Nat_Sum_Sales] on a Card, without the Switch, the currency symbol is there ... So it looks like it's all about the Switch.

 

Many Thanks in advance,

Peter.

 

2 ACCEPTED SOLUTIONS
v-chuncz-msft
Community Support
Community Support

@peter_rips,

 

Instead, you could use the FORMAT Function.

https://msdn.microsoft.com/en-us/library/ee634561.aspx

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

View solution in original post

@v-chuncz-msft, thanks 😉

Here it is, ugly but working. 🙂

 

NAT_U_S_Selector_F$ = 
SWITCH( TRUE(),
	VALUES('Selector'[Measure]) = "Units", Facts[NAT_SumU],
        VALUES('Selector'[Measure]) = "Value",
IF(Facts[NAT_Sum_Sales] > 1000000 , FORMAT(Facts[NAT_Sum_Sales]/1000000,"$0.00") & "M",
IF (Facts[NAT_Sum_Sales] > 1000 && (Facts[NAT_Sum_Sales]) < 999999, FORMAT(Facts[NAT_Sum_Sales]/1000,"$0.00") & "K",
IF(Facts[NAT_Sum_Sales] > 0 && Facts[NAT_Sum_Sales] < 1000, FORMAT(Facts[NT_Sum_Sales]/1,"$0"),(Facts[NAT_Sum_Sales])))), BLANK())

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@peter_rips,

 

Instead, you could use the FORMAT Function.

https://msdn.microsoft.com/en-us/library/ee634561.aspx

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

@v-chuncz-msft, thanks 😉

Here it is, ugly but working. 🙂

 

NAT_U_S_Selector_F$ = 
SWITCH( TRUE(),
	VALUES('Selector'[Measure]) = "Units", Facts[NAT_SumU],
        VALUES('Selector'[Measure]) = "Value",
IF(Facts[NAT_Sum_Sales] > 1000000 , FORMAT(Facts[NAT_Sum_Sales]/1000000,"$0.00") & "M",
IF (Facts[NAT_Sum_Sales] > 1000 && (Facts[NAT_Sum_Sales]) < 999999, FORMAT(Facts[NAT_Sum_Sales]/1000,"$0.00") & "K",
IF(Facts[NAT_Sum_Sales] > 0 && Facts[NAT_Sum_Sales] < 1000, FORMAT(Facts[NT_Sum_Sales]/1,"$0"),(Facts[NAT_Sum_Sales])))), BLANK())

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.