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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Rai_BI
Helper IV
Helper IV

Adjust the measure to also calculate the sum for the grid total

Hi friends,

How can I adjust the DAX measure below to also calculate the sum for the grid total?

I have the following DAX measure below, it works correctly, but it is not calculating the total value of the grid which is returning empty. I'm trying to use the SUMX function but it's not working to calculate the total.

Download the PBIX here

 

 

Single Measure = 

VAR Seller_1_in_Scope = HASONEFILTER('customer table'[Name Seller1])
VAR Seller_2_in_Scope = HASONEFILTER('customer table'[Name Seller2])

RETURN
SWITCH(
    TRUE(),
    Seller_1_in_Scope && NOT Seller_2_in_Scope, 
    SUMX(
        VALUES('customer table'[Name Seller1]),CALCULATE([Goal Seller 1])),

    Seller_2_in_Scope && NOT Seller_1_in_Scope, 
    SUMX(
        VALUES('customer table'[Name Seller2]),CALCULATE([Goal Seller 2])),

    Seller_1_in_Scope && Seller_2_in_Scope, 
    SUMX(
        SUMMARIZE(
            'customer table',
            'customer table'[Name Seller1],'customer table'[Name Seller2]),
            CALCULATE([Goal Seller 1] + [Goal Seller 2])
)
)

 

Sem título.png

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Rai_BI Try using HASONEVALUE instead of HASONEFILTER.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

I already try it, but did not work.

v-shex-msft
Community Support
Community Support

HI @Rai_BI,

It seems like a common issue that appears when measure calculate with multiple aggregations, you can refer other greg's blog to know how to handle this scenario.

Measure Totals, The Final Word 
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you, looks like we´re in rigth track. But i still don´t know how to apply this solution on my issue, can you help me?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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