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
Pikachu-Power
Post Prodigy
Post Prodigy

AVERAGEX excluding blank

Hi all,
 
how can i avoid that the following measure divide by blank.
For example for quarter 4 i have no values/blank.
The formula divides by 4. i want to divide by 3.
 
MEASURE =
AVERAGEX(
    TABLE,
    SWITCH (
        TRUE (),
        TABLE[Quarter] = 1, IF(TABLE[KONTO] = "SBA", DIVIDE(SUM(TABLE[Ist]),SUM(TABLE[A])), BLANK()),
        TABLE[Quarter] = 2, IF(TABLE[KONTO] = "SBA", DIVIDE(SUM(TABLE[Ist]),SUM(TABLE[B])), BLANK()),
        TABLE[Quarter] = 3, IF(TABLE[KONTO] = "SBA", DIVIDE(SUM(TABLE[Ist]),SUM(TABLE[C])), BLANK()),
        TABLE[Quarter] = 4, IF(TABLE[KONTO] = "SBA", DIVIDE(SUM(TABLE[Ist]),SUM(TABLE[D])), BLANK()),
        "Quarter unknown"
    )
)
5 REPLIES 5
amitchandak
Super User
Super User

@Pikachu-Power , In that case, take a sum and take count and divide them ideally count should not count blank.

I doubt Average does

 

Same formula with sumx and countx and divide

 

I am not sure how it allowed that value "Quarter unknown" should be replaced with blank()

I cant take SUMX und COUNTX instead of AVERAGEX. I get different results.

 

Column D ist empty.

Hi  @Pikachu-Power ,

 

Could you pls provide some data with expected output ? We will try our best to work out  a solution.

 


 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

@Pikachu-Power we are guessing. Provide data please.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Super User
Super User

What is in Table[D] @Pikachu-Power - you have asked it to divide by the sum of column D. Please share some data.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.