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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mhablas426
Advocate II
Advocate II

Conditionals formatting based on a column in the same visualization table

Guys,
I want to make conditional formatting based on column number (3) for the below table using DAX:
the values of column num (2) will appear in red if they exceed the values in front of it in column num (3), and they will be displayed in green if they do not exceed.
And please How can I apply this Dax to the table?
Thanks a lot
TableTable

1 ACCEPTED SOLUTION

PFA , PBIX with table




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

12 REPLIES 12
mhablas426
Advocate II
Advocate II

It's a visualization table, not an data or regular table and I used the below measure to build it

Fuel Current Month Q =
CALCULATE(
    SUM('BI Fuel Issue'[Fuel Day Quantity])+SUM('BI Fuel Issue'[Fuel Night Quantity]),
    MONTH('F Dim Date'[Date])=MONTH(TODAY()),
    YEAR('F Dim Date'[Date])=YEAR(TODAY())
)
 so the question now How can I do the above measure as a table so can apply your answer to it

Screenshot 2024-07-04 155014.jpg

 

@mhablas426 , First create a measure as per columns in your table

ColorMeasure =
IF(
[Fuel Current Month Q] > [SomeOtherMeasure], -- Replace [SomeOtherMeasure] with the actual measure or column you want to compare against
"Red",
"Green"
)

 

Then

1.Go to the Report view.
2.Add a table visual to the report and include the columns you want to display.
3.Select the table visual.
4.Go to the Format pane (paint roller icon).
5.Expand the Conditional formatting section.
6.Click on the drop-down arrow next to the column you want to format (e.g., Fuel Current Month Q) and select Background color or Font color.
7.In the Conditional formatting window:
Set the Format by option to Field value.
8.Set the Based on field option to the measure you created (ColorMeasure).
Click OK to apply the conditional formatting.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks for your reply and your time, but I want first to convert this visualization table to a data table, a regular table!! How can I do that?
thank you again

@mhablas426 , Are you taking columns from different sources in this visualization?




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






yes, kindly see the snapshot Screenshot 2024-07-05 091158.jpg

 

There are two ways you can do that first go to power query and use merge queries as new option and combined table 1 and 2 first on the basis of column on which relation is created then do it similarly for 3 rd table or use DAX to create new column

 

CombinedTable =
SELECTCOLUMNS(
NATURALINNERJOIN(
NATURALINNERJOIN(Table1, Table2),
Table3
),
"Column1", Table1[Column1],

 

Only if they share common key
"Column2", Table2[Column2],
"Column3", Table3[Column3]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






How can i share with you the PBIX file here?

You could upload the file to OneDrive / Google Drive / DropBox and share the link here.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






PFA , PBIX with table




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Many thanks to you. I appreciate your help  🙏

bhanu_gautam
Super User
Super User

@mhablas426 , You can create a simple DAX for this

 

Column2Color =
IF(
SELECTEDVALUE('YourTable'[Column2]) > SELECTEDVALUE('YourTable'[Column3]),
"Red",
"Green"
)

 

Select the Table Visual: Click on the table visual where you want to apply the conditional formatting.

Open Conditional Formatting Options:

Go to the Format pane.
Expand the Conditional formatting section.
Click on the fx button next to the Font color option for the column you want to format (Column 2 in this case).
Set Up Conditional Formatting:

In the Conditional formatting window, select Field value under the Format by dropdown.
In the Based on field dropdown, select the measure you created (Column2Color).
Apply the Formatting: Click OK to apply the conditional formatting.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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