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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Instead of blank value need to fill 0

Hi,

 

I have one matrix where we have not the data for selected category and country, So I want to fill this blank with 0 value.

RFT CUC =
var gap = CALCULATE(distinctCOUNT(TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[SPECIFICATION]),FILTER(TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC,TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[RFT_REMARK]="No_Gap"))
var c = CALCULATE(distinctCOUNT(TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[SPECIFICATION]),REMOVEFILTERS(TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[RFT_REMARK]))
var per= DIVIDE(gap,c,BLANK())
var res=COALESCE(per,0)
return res

I am using this DAX to calculate this percentage.

Please help me to do this

 

Abhi21970_1-1634134824797.png

 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @Anonymous ,

 

I think you can just modify your DAX as follows:

RFT CUC =
VAR gap =
    CALCULATE (
        DISTINCTCOUNT ( TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[SPECIFICATION] ),
        FILTER (
            TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC,
            TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[RFT_REMARK] = "No_Gap"
        )
    )
VAR c =
    CALCULATE (
        DISTINCTCOUNT ( TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[SPECIFICATION] ),
        REMOVEFILTERS ( TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[RFT_REMARK] )
    )
VAR per =
    DIVIDE ( gap, c, BLANK () )
VAR res =
    COALESCE ( per, 0 )
RETURN
    res + 0

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

The information you provided is vague and it is hard for us to judge.

You can try:

RETURN
    IF ( res = BLANK (), 0, res )

If total is displayed incorrectly, you also need to use sum(summarize ()) to calculate total.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.


Best Regards,

Community Support Team _ Janey

Pragati11
Super User
Super User

Hi @Anonymous ,

 

I think you can just modify your DAX as follows:

RFT CUC =
VAR gap =
    CALCULATE (
        DISTINCTCOUNT ( TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[SPECIFICATION] ),
        FILTER (
            TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC,
            TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[RFT_REMARK] = "No_Gap"
        )
    )
VAR c =
    CALCULATE (
        DISTINCTCOUNT ( TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[SPECIFICATION] ),
        REMOVEFILTERS ( TT_POWER_BI_DQ_SCORE_FTR_COMBINED_CUC[RFT_REMARK] )
    )
VAR per =
    DIVIDE ( gap, c, BLANK () )
VAR res =
    COALESCE ( per, 0 )
RETURN
    res + 0

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi @Pragati11 

This solution is not working. when I have applied that this dax the result is same.
Actually the problem is I don't have the combination of that category and country in my data table.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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