cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
MrHippo85
Regular Visitor

Text value if calculate DAX output is blank

Hi there

 

I am looking to impliment a measure to use in a matrix that provides a total count of a column based on today's date BUT also have it output a text value of "No Data" when there is no data available i.e. Blank.

 

Using a filtered value quick measure within a matrix produces the desired output when today's data is available:

 
Measure = CALCULATE(
    SUM('Table' [COUNT]),
    'Date DIM Table' [Today]
        IN { TRUE }
)
 
However, this just gives an empty column in the matrix when there is no data.
 
I have tried to add variables to the above DAX to produce the "No Data" output:

Measure =
VAR sum_quantity = CALCULATE(
    SUM('Table'[COUNT]),
    'Date DIM Table'[Today]
        IN { TRUE }
)
VAR sum_quantity_blank = IF(sum_quantity = BLANK(), "No Data", sum_quantity)
RETURN sum_quantity_blank

However, this does not work, as I get an error message saying that I "Cannot convert value "No Data" of type text to type integer/date"
 
This seems to be a really simple fix, but can't seem to find anything on this to resolve it.
 
Any help would be massively appreciated!
Cheers
4 REPLIES 4
LightTheWay
Frequent Visitor

Measure = IF(ISBLANK(CALCULATE( SUM('Table' [COUNT]), 'Date DIM Table' [Today] IN { TRUE } ), "No Data")

 

This should work

Hi there

 

Thanks for your quick reply, however, I get an error when I use this saying that too many arguments were passed to the ISBLANK function?

Sorry, should be an extra bracket to close the calculate:

Measure = IF(ISBLANK(CALCULATE( SUM('Table' [COUNT]), 'Date DIM Table' [Today] IN { TRUE } )), "No Data")

Hi again

 

This seems to be working partly (so am getting "No Data" showing when there is no data) but nothing when there is.

 

Is this because I have not provided a result if true statement in the IF clause? If so, I am assuming that I would just need to do the following?

 

Measure = IF(ISBLANK(CALCULATE( SUM('Table' [COUNT]), 'Date DIM Table' [Today] IN { TRUE } ), "No Data", CALCULATE( SUM('Table' [COUNT]), 'Date DIM Table' [Today] IN { TRUE } )

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors