Do a Format for Only One Row?

I have this measure in DAX:

SWITCH ( TRUE () ,
 MIN ( 'Dynam'[ID] ) = 5 , DIVIDE ( [Gross] , [Revenue] ) * 100,    
 MIN ( 'Dynam'[ID] ) = 8 ,  [Hours]

)

I would like the first one to have one decimal, but not the second one.

Can I do a formatting for one row only?

As of now, I have it like this for the entire measure:

1

1 Answer

Here are a few options:

  1. Like Jeroen said, you can use FORMAT in your measure but it will be text. If you can't have the measure as text is some places, just have a text measure and a number measure.
  2. Use two measures, one for hours and one for dollars. You can't really chart or SUM things well when sometimes it's hours and sometimes it's dollars, so split them out.
  3. You could always drop the decimals on the dollars and use whole number for both.
  4. If your data for both is always positive, you can play tricks with the positive and negative formats in Power BI (and probably SSAS?) using a custom format string such as 0.00;0;0. In a custom format string, the first format is the positive number, the second is negative, and the last is zero. The trick is to use the positive format for dollars and the negative format for hours. Here, positive numbers are shown with decimals (0.00), negative numbers are shown as whole numbers without a minus sign so that they look like positive numbers (0):

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest