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
shelmy
New Member

Changing color using DAX and conditional formatting in Excel

Hello, I need your help to solve this problem:

I have a workbook whose source is a tabular cube, I would like to be able to write a dax function from the cube which would allow the values to be conditionally formatted (Red, green or nothing at all) when the data is consulted from Excel.

 

PS: users connect to the cube and view the data independently as they wish, so I can't use the conditional formatting which is in Excel. This would have to be done from the cube and Excel would just have to display the values with the corresponding background colours.


I tried the switch like this :

= SWITCH(
TRUE(),
'vente'[EstLigne] = TRUE(), "#228B22",
'vente'[EstLigne] = FALSE(), "#ff0000",
"#000000"
)

mais il me renvoie les couleurs sous forme texte.

shelmy_0-1718635609069.png

 

Thank you in advance

2 REPLIES 2
shelmy
New Member

Hi Adam, 

it's a classic tabular cube with 2 fact tables and associated analysis axes.

I'll take a simple example:

I have a sales tabular cube with 2 analysis axes (Product and Customer) and a fact table. What I want is to display the data from the fact table FtSales with a green background for sales where the invoice is >= €5000, red if the invoice <= €5000 and white for the rest.
I would like to do this from the cube so that once it is displayed in an Excel workbook the formatting is applied when these columns are displayed in the TCD by the end users.

 

Thanks in advance.

v-kongfanf-msft
Community Support
Community Support

Hi @shelmy ,

 

Can you provide more information about the modeling associated with tabular cube?

 

Adamk Kong,

Best regards

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! Prices go up Feb. 11th.

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.