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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
IF
Post Prodigy
Post Prodigy

substract with decimal

Hi,

I want to substract between two measures and colour the result. For example;

Measure1Measure2Rounded Measure1Rounded Measure2Difference
0.1960.2040.200.200
0.1910.2040.190.20-0.01
0.1970.1950.200.200

 

I used table, but actually it is not possible to use table as they are measure. I use format change:

32.jpg

However, I can not change the colour of the result with the calculation logic to use the result Measure3=Rounded Measure1-Rounded Measure2:

 

332.jpg

 

If the difference is 0, it should be green, but it doesn't calculate based on the rounded measure. In the third case, it should be green, but it is shows the value with red.

 

How can I use colouring based on the rounded measures?

 

Thanks in advance!

 

 

4 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

You can use a simpler approach. Your Measure3 can directly compute the desired RGB color, and then your conditional formatting can use the value of Measure3 directly as well (rather than rules)

View solution in original post

Fowmy
Super User
Super User

@IF 

 

Use Measure 3  as the measure for the conditional formatting as follows:

Fowmy_0-1608915818920.png

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

v-robertq-msft
Community Support
Community Support

Hi, @IF 

According to your description and picture, I guess that you want to get the difference of the round value of the two measures and set conditional format based on their difference, you can try my steps:

  1. I suggest you to use DAX to get the round value of the two measures, you can create these measures:
Rounded Measure1 = ROUND([Measure1],2)
Rounded Measure2 = ROUND([Measure2],2)
Measure3 = [Rounded Measure1]-[Rounded Measure2]
Color =

SWITCH(

    TRUE(),

    [Measure3]=0,"Green",

    [Measure3]<0,"Red",

    [Measure3]>0,"Black")
  1. Then create a table chart and place columns and open the conditional format, like this:

v-robertq-msft_0-1609124598717.png

 

  1. Then set the conditional format like this:

v-robertq-msft_1-1609124598720.png

 

And you can get what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

Yes, I thought of using a card to change the color accordingly. Thanks a lot! Happy holidays!

View solution in original post

10 REPLIES 10
v-robertq-msft
Community Support
Community Support

Hi, @IF 

According to your picture, I guess that you want to set the conditional format of the font color of the value in a Card chart, I don’t think it’s possible. Because conditional format can only apply to table and matrix charts in Power BI, you can not set conditional format for other charts.

Therefore, I suggest you to still use a table chart to achieve this, you make some changes based on my solution above:

Go to the Format forum, select “Conditional formatting”, close the “Background color” and open the “font color”, like this:

v-robertq-msft_0-1609143413981.png

 

Then set like this:

v-robertq-msft_1-1609143413986.png

 

And you can get what you want, like this:

屏幕截图 2020-12-28 161726.png

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes, I thought of using a card to change the color accordingly. Thanks a lot! Happy holidays!

IF
Post Prodigy
Post Prodigy

Thanks a lot All of you!

 33.jpgif I want to display the value in red, green or black color by calculating the difference between two measures, what would be the best?

All the best

v-robertq-msft
Community Support
Community Support

Hi, @IF 

According to your description and picture, I guess that you want to get the difference of the round value of the two measures and set conditional format based on their difference, you can try my steps:

  1. I suggest you to use DAX to get the round value of the two measures, you can create these measures:
Rounded Measure1 = ROUND([Measure1],2)
Rounded Measure2 = ROUND([Measure2],2)
Measure3 = [Rounded Measure1]-[Rounded Measure2]
Color =

SWITCH(

    TRUE(),

    [Measure3]=0,"Green",

    [Measure3]<0,"Red",

    [Measure3]>0,"Black")
  1. Then create a table chart and place columns and open the conditional format, like this:

v-robertq-msft_0-1609124598717.png

 

  1. Then set the conditional format like this:

v-robertq-msft_1-1609124598720.png

 

And you can get what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AllisonKennedy
Super User
Super User

@IF  You have the 'equal to' in the wrong line. If you want 0 to be green, it must say 'is less than or equal to' 0 then green. and 'is greater than' 0 then red.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

lbendlin
Super User
Super User

Here's a sample code.  you can also use the hash codes, like "#FF0000" for red etc.

 

Measure3:=switch(true(),Measure1>Measure2,"green",Measure1<Measure2,"red","grey")

Fowmy
Super User
Super User

@IF 

 

Use Measure 3  as the measure for the conditional formatting as follows:

Fowmy_0-1608915818920.png

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@IF 

Please check the attached file:  https://1drv.ms/u/s!AmoScH5srsIYgY0ZdMZNP_JG8I_YHg?e=xAikif


Refer to this article for more information.:https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

lbendlin
Super User
Super User

You can use a simpler approach. Your Measure3 can directly compute the desired RGB color, and then your conditional formatting can use the value of Measure3 directly as well (rather than rules)

I am not very good at Power BI. How could I do it?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors