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
Anonymous
Not applicable

$ sign currency for only few rows based upon condition

Hi @all,

Please let me know if I can make changes to the currency only for few values in a column. 
For Example: If the type is Quantity then Value is 39. If the Type is Dollar then value is $540.

TypeValue
Quantity39
Dollar$540

 

Let me know with the possiblity. Thanks in advance.

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

@Anonymous 

you can duplicate the measure and format each accordingly using the formatting options under "Measures tools" in the ribbon. Then use SWITCH to deliver the required output:

Measure format = SWITCH(TRUE(),

SELECTEDVALUE(table column [type]) = "Quantity", [number formatted measure],

[dollar formatted measure])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

11 REPLIES 11
PaulDBrown
Community Champion
Community Champion

@Anonymous 

you can duplicate the measure and format each accordingly using the formatting options under "Measures tools" in the ribbon. Then use SWITCH to deliver the required output:

Measure format = SWITCH(TRUE(),

SELECTEDVALUE(table column [type]) = "Quantity", [number formatted measure],

[dollar formatted measure])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi @PaulDBrown ,

Can I fix the Decimal point to 2 in the in the Format with Currency ?

currency.JPG

 

Currently it is not showing the decimal point as underlined with red in above screenshot.

@Anonymous 

Sure. Select the measure, got to "Measure tools" in the ribbon and in the box for decimals in the formatting section type in 2.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

@PaulDBrown ,

I had did that but it works for quantity value. 
It is not working on format $

@Anonymous 

 

Make sure the field/value is formatted as "None" under "Display Units" in the formatting pane.

Currency decimals.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi @PaulDBrown ,

Yes The Display units is "None"  in field formating. I see there is no 2 decimal points in your visual under Sum of Target column.

@Anonymous 

 

Sorry, I should have clarified... I live in a land where the thousands seperator is defined by a " ." and the decimals by a " , " (so you can see there are indeed two decimal places in the values under sum of target).

Currency decimals.JPG

 

So I'm not sure what is going on at your end. I take it the column itself is actually a number format (not "general" or "text")





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Thanks for clarifying about seperator @PaulDBrown . 
Seperator for Thousands here is " , " and decimal is " . " so I was confused in checking that.

Anonymous
Not applicable

Thanks @PaulDBrown . That really worked.

danextian
Super User
Super User

Hi @Anonymous ,

 

You can create a calculated column but this will return a text and cannot be summed up.

Calculated Column =
IF (
    'Table'[Type] = "Quantity",
    FORMAT ( 'Table'[Value], "#,#" ),
    IF ( 'Table'[Type] = "Dollar", FORMAT ( 'Table'[Value], "$#,#" ) )
)

 

Alternatively, you can instead use a measure to aggregate Value and then format it:

Measure =
VAR __VALUE =
    SUM ( 'Table'[Value] )
VAR __TYPE =
    //there must be a single selected value in the current filter context or this will return a blank result
    SELECTEDVALUE ( 'Table'[Type] )
RETURN
    IF (
        __TYPE = "Quantity",
        FORMAT ( __VALUE, "#,#" ),
        IF ( __TYPE = "Dollar", FORMAT ( __VALUE, "$#,#" ) )

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hi @danextian ,

Thanks for the reply. I tried using the below and shows the error in the screenshot. Can you help me with that ?

Calculated column = IF(FinalTable[Type] == "Quantity1" || FinalTable[Type]=="Quantity2", IF(FinalTable[Value] == "" || ISBLANK(FinalTable[Value]), 0, FORMAT(FinalTable[Value], "#,#")), IF(FinalTable[Value] == "" ||ISBLANK(FinalTable[Value]) , 0, FORMAT(FinalTable[Value], "$#,##0;($#,##0)")))

Error: DAX comparison operations do not support comparing values of type Number with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

daxerror.JPG

 

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.