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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
atasgao
Helper II
Helper II

Replacing blank values with "-" in matrix visual

Hello Everyone, 

So, I want replace the blank cell with the "-".  

atasgao_1-1639689269219.png

I am using multple formula to filter out the field. 

YTD Budget Hours = if(ISFILTERED(FactLaborActualHourBV[EmployeeName])|| ISFILTERED(FactLaborBudgetHourBV[BudgetLaborHour]),BLANK(),FactLaborBudgetHourBV[BudgetHourYTD]) so, that it does not show the whole list of employees. 

To calculate the BudgetHourYTD I am using this below formula

BudgetHourYTD = CALCULATE([M_BudgetLaborHour],FILTER(ALL( DimDate[Month] ), DimDate[Month] <= IF(Day(Now())<=15,Month(Now())-2,MONTH(Now())-1))). 
 
How can I add "-" if blank?
Thanks for your help in advance
 
Regards, 
Aakanksha 
1 ACCEPTED SOLUTION

Hi @atasgao ,

 

Please try the following formula:

 

ALLBlankRows = 
[YTD Budget Hours] = BLANK ()
    && [YTD Actual Hours] = BLANK ()
    && [YTD Hours Variance] = BLANK ()
    && [Annual Budget Hours] = BLANK ()
Replace_YTD_Budget = IF ( [ALLBlankRows], BLANK (), COALESCE ( [YTD Actual Hours], "-" ) )
Replace_YTD_Actual = IF ( [ALLBlankRows], BLANK (), COALESCE ( [YTD Actual Hours], "-" ) )

vkkfmsft_0-1640158765606.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

6 REPLIES 6
AllisonKennedy
Super User
Super User

@atasgao 

 

Depending on your data model you can try: 

 

- Measure  = IF(ISBLANK ( [BudgetHourYTD], "-", [BudgetHourYTD]) )

 

Note that will be a variable data type measure so can't be used in some totals, calculations, etc. It may also give you more rows in your matrix than you wish so you may need to add further filters into your IF statement.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy It is populating for all the records. 

atasgao_0-1639695851284.png

 

Hi @atasgao ,

 

If the Business Unit rows you want to hide remains hidden after the replacement, then you can try the following way.

 

1. Create measure to filter out the rows of Business Unit that are not all null.

 

Measure = 
var unit = VALUES ( FactLaborActualHourBV[Employee Labor Business Unit] )
var NotBlankRows = 
    CALCULATETABLE (
        VALUES ( FactLaborActualHourBV[Employee Labor Business Unit] ),
        FILTER (
            ALLSELECTED ( FactLaborActualHourBV[Employee Labor Business Unit] ), 
            [YTD Budget Hours] <> BLANK()
                || [YTD Actual Hours] <> BLANK()
                || [Annual Budget Hours] <> BLANK()
                || [YTD Hours Variance] <> BLANK()
        )
    )
return 
    COUNTROWS ( INTERSECT ( unit, NotBlankRows ) )

 

2. Then use the measure to filter the Business Unit column in the visual.

 

vkkfmsft_1-1640054834726.png

 

3. Then replace the blank values.

 

NonBlank YTD Budget = COALESCE ( [YTD Budget Hours], "-" )
NonBlank YTD Actual = COALESCE ( [YTD Actual Hours], "-" )

 

4. The final result is:

 

vkkfmsft_0-1640054767880.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-kkf-msft It's working but the problem is under the employee labor business unit it is giving all the employee name irrespectively of wheater we have data or not. 

atasgao_0-1640063790298.png

Thanks, 

Aakanksha 

Hi @atasgao ,

 

Please try the following formula:

 

ALLBlankRows = 
[YTD Budget Hours] = BLANK ()
    && [YTD Actual Hours] = BLANK ()
    && [YTD Hours Variance] = BLANK ()
    && [Annual Budget Hours] = BLANK ()
Replace_YTD_Budget = IF ( [ALLBlankRows], BLANK (), COALESCE ( [YTD Actual Hours], "-" ) )
Replace_YTD_Actual = IF ( [ALLBlankRows], BLANK (), COALESCE ( [YTD Actual Hours], "-" ) )

vkkfmsft_0-1640158765606.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-kkf-msft This works! Thanks 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors