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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
himanshu56
Resolver II
Resolver II

Color Code Blank value

Hi All,

 

I am facing an issue while applying conditional formatting. Please find below requirement with expected output and current output.

 

Note: 1) The values are sum of sales.

2) Blank means product was not available for a particular week hence blank

3) Blank can't be replaced with 0. That's the business requirement

 

Expected : The requirement is when week number<= current week, then color code yellow else blue.

 

power bi.PNG

 

But instead of the above, I get this:

 

powe bi.PNG

 

Issue: The DAX is not taking blank values into consideration. I have applied 3-4 methods. But none of them are working on blank values. 

 

I have tried:  if( week number<= current week && Sum(Sales)) = BLANK(), then color code yellow else blue.

 

Can anybody please let me know the solution of this problem?

 

Thanks,

Himanshu

 

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @himanshu56 ,

 

We can create a measure as value field after create a spreated calculated table as the column header:

 

Calculated table:

 

 

Week = ADDCOLUMNS(DISTINCT('Table'[WeekNumber]),"Week Name","Week "&[WeekNumber])

 

1.jpg 

 

Measure:

 

 

total = IF(COUNTROWS('Table')=0,BLANK(),CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[WeekNumber] in DISTINCT('Week'[WeekNumber])))) & ""

 

 

Color Field Measure:

 

 

Color = IF(SELECTEDVALUE('Week'[WeekNumber])<=[Current Week],"#FFFF00","#0000FF")

 

 

2.jpg

 


Best regards,

 

Community Support Team _ Dong Li
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

2 REPLIES 2
v-lid-msft
Community Support
Community Support

Hi @himanshu56 ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @himanshu56 ,

 

We can create a measure as value field after create a spreated calculated table as the column header:

 

Calculated table:

 

 

Week = ADDCOLUMNS(DISTINCT('Table'[WeekNumber]),"Week Name","Week "&[WeekNumber])

 

1.jpg 

 

Measure:

 

 

total = IF(COUNTROWS('Table')=0,BLANK(),CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[WeekNumber] in DISTINCT('Week'[WeekNumber])))) & ""

 

 

Color Field Measure:

 

 

Color = IF(SELECTEDVALUE('Week'[WeekNumber])<=[Current Week],"#FFFF00","#0000FF")

 

 

2.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.