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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Tara_01
Helper II
Helper II

DAX Measure for blank values

Hi all,

 

Urgent help !! I am writing a dax measure for a matrix table so the table has month in columns and Items in row will share the screenshot below for reference. I have a slicer for year & for NWA Numbers

Now the condition required is if the year is between 2020 till 2022 I want the color of columns to be green including the Row grand total. Now if the year is 2023 I need the current month which is february as green rest all other months as blue including the Row grand total. However for certain month there are records in the excel file which is used for the matrix table values because of which it is blank so how do I write a measure for blank cells 

Measure written as follows :

IF (Max(Month index) > Month(now) && Max(Year) = year(now) , "Sky Blue", "Light Green")

In this what happens is for the blank cells which don't have records in the file the condition fails and it show light green even the month is not the current month screen shot as below can someone help me writing the dax for this one. Your help is appreciated

 

Tara_01_0-1676348997470.png

 

 

2 REPLIES 2
achanikya
Helper I
Helper I

@Tara_01 

try 

 

IF(
OR(
Max(Month index) > Month(now) && Max(Year) = year(now),
AND(Max(Month index) = 2, Max(Year) = 2023)
),
IF(ISBLANK(SUM(MatrixTable[Value])), BLANK(), "Sky Blue"),
"Light Green"
)

Hi,

 

thankyou for the help but it's not working I have been trying to get blank values of the rest of the months as blue but it is showing green only since it's failing the condition

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors