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

Result 0 if no data present

Hello all, 

 

Building a report in which the matrix results blanks (of course) where there is not data entry for those months. 

 

I am using an HASONEVALUE and AVERAGEX which gives me the results I want. I just need help swaping the blank cells in the matrix to present a 0% so the average is correct. 

 

Usage Average = IF (
HASONEVALUE ( Equip_Utl_Days[Period] ),
[Usage Percent Max 100],
AVERAGEX (
VALUES ( Equip_Utl_Days[Period] ),
Equip_Utl_Days[Usage Percent Max 100]
)
)
 
 
 

Capture.JPG

10 REPLIES 10
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

for your case, you should need to add a if conditional in the formula to judge that only replace blank with 0 which are in the current period.

please share your sample pbix file, that will be a great help.

 

Regards,

Lin

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

@Anonymous 

Since you do not have data for those periods, no calculation takes place there. To get the correct average, you need to modify the measure as:

Usage Average = 
IF (
    HASONEVALUE ( Equip_Utl_Days[Period] ),
        [Usage Percent Max 100],
    DIVIDE(
        SUMX( 
            VALUES ( Equip_Utl_Days[Period] ),
            Equip_Utl_Days[Usage Percent Max 100]
        ),
        COUNTROWS(VALUES ( Equip_Utl_Days[Period] ))
    )
)

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy , thank you for your reply.

 

This still leaves banks where before. 

@Anonymous 

As far as I know, that blank cannot be replaced.

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy 

 

Thank you. 

 

I guess then I would create a new column in the table where you have 0 if nothing else is present for each period. 

 

@Anonymous 

That should work for you.

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@cwalraven try to use the following DAX:

VAR _avg =

HASONEVALUE ( Equip_Utl_Days[Period] ),
[Percentage of usage max. 100],
AVERAGEX (
VALUES ( Equip_Utl_Days [Period] ),
Equip_Utl_Days[Max. 100 Usage Percentage]
)
Return
IF(ISBLANK(_avg),0,_avg)

Hi @Anonymous ,

 

Try to add the +0 to the [Usage Percent Max 100] measure and not to this final measure.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @Anonymous 

 

Add +0 to your measure and will get 0% on your cells.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

@MFelix 

 

Yes I do get 0% but it overwrites all results as 0%.

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.