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
PBI_newuser
Post Prodigy
Post Prodigy

Incorrect Grand Total of measures

Hi, how to create a measure to make sure the grand total is the sum of each rows in the table? Below screenshot shows the incorrect total for both fields. Here is the pbix file. 

 

PBI_newuser_0-1638409811793.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PBI_newuser , the second one has some value in decimal place , so getting rounded of two one value higher. Please changes these measures

 

 

Volume Impact = 
  IF (
    MIN ( 'Calendar'[Date] ) > MAX ( 'Append Table'[Date] ),
    CALCULATE (
        SUMX (
            SUMMARIZE ( 'Append Table', 'Calendar'[YearMonth] ,'Append Table'[Product]),
            IF (
                [Volume Last Year] <= 0,
                ( [Revenue] - [Revenue Last Year] ),
                ( [Volume Sum] - [Volume Last Year] ) * [AUSP Last Year]
            )
        ),
        SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
    )*-1,
    SUMX (
        SUMMARIZE ( 'Append Table', 'Calendar'[YearMonth],'Append Table'[Product] ),
        IF (
            [Volume Last Year] <= 0,
            ( [Revenue] - [Revenue Last Year] ),
            ( [Volume Sum] - [Volume Last Year] ) * [AUSP Last Year]
        )
    )
)




Volume Impact Total = SUMX (VALUES('Calendar'[YearMonth]), [Volume Impact] )



Price Impact = 
SUMX(
 SUMMARIZE('Append Table','Calendar'[YearMonth], 'Append Table'[Product]),
    IF([Volume last year]<=0,0,([AUSP Current Year]-[AUSP Last Year])*[Volume Sum]))

 

 

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Presume that your current measures are correct, the amendment is simple enough,

= SUMX(VALUES('Append Table'[Product]), [Price Impact])
= SUMX(VALUES('Append Table'[Product]), [Volume Impact Total])

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

amitchandak
Super User
Super User

@PBI_newuser , the second one has some value in decimal place , so getting rounded of two one value higher. Please changes these measures

 

 

Volume Impact = 
  IF (
    MIN ( 'Calendar'[Date] ) > MAX ( 'Append Table'[Date] ),
    CALCULATE (
        SUMX (
            SUMMARIZE ( 'Append Table', 'Calendar'[YearMonth] ,'Append Table'[Product]),
            IF (
                [Volume Last Year] <= 0,
                ( [Revenue] - [Revenue Last Year] ),
                ( [Volume Sum] - [Volume Last Year] ) * [AUSP Last Year]
            )
        ),
        SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
    )*-1,
    SUMX (
        SUMMARIZE ( 'Append Table', 'Calendar'[YearMonth],'Append Table'[Product] ),
        IF (
            [Volume Last Year] <= 0,
            ( [Revenue] - [Revenue Last Year] ),
            ( [Volume Sum] - [Volume Last Year] ) * [AUSP Last Year]
        )
    )
)




Volume Impact Total = SUMX (VALUES('Calendar'[YearMonth]), [Volume Impact] )



Price Impact = 
SUMX(
 SUMMARIZE('Append Table','Calendar'[YearMonth], 'Append Table'[Product]),
    IF([Volume last year]<=0,0,([AUSP Current Year]-[AUSP Last Year])*[Volume Sum]))

 

 

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.