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
Parthsh93
Helper IV
Helper IV

Wrong totals

After digesting so much information, I still struggle to gets the totals right.

 

Here is the problem

17.PNG

The actual sum is = 55,01,802

WhatsApp Image 2020-05-23 at 02.21.54.jpeg

 

While if I have year filtered to 2019, I shows exact values
18.PNG

Here are all the measures I have coded

 

 

loadability savings corrected = 
SUMX(
    SUMMARIZE(
             dDate,dDate[Month],"_2",
               IF(
                  [Shipments Saved_corrected]=0||BLANK(),BLANK(),
                       DIVIDE(
                             SUMX('Prototype Modeling_Freight','Prototype Modeling_Freight'[Load Charge]),
                 [Shipments],BLANK())*[Shipments Saved_corrected])
             ),
     [_2])
Shipments Saved_corrected = 
VAR last_M_Shipments = DIVIDE([Volume],CALCULATE([Loadability volumetric],DATEADD(dDate[Date],-1,MONTH)),BLANK())
return 
IF(
    last_M_Shipments=BLANK(),BLANK(),SUMX(SUMMARIZE(dDate,dDate[Month],"_1",last_M_Shipments-[Shipments]),[_1]))
Shipments = SUMX('Prototype Modeling_Freight','Prototype Modeling_Freight'[# Shipments])
Loadability volumetric = DIVIDE([Volume],[Shipments],BLANK())

 

 

 

1 ACCEPTED SOLUTION
nandukrishnavs
Super User
Super User

@Parthsh93 

 

Try this

loadability savings corrected =
SUMX (
    SUMMARIZE (
        dDate,
        dDate[Year],
        dDate[Month],
        "_2", IF (
            [Shipments Saved_corrected] = 0
                || BLANK (),
            BLANK (),
            DIVIDE (
                SUMX (
                    'Prototype Modeling_Freight',
                    'Prototype Modeling_Freight'[Load Charge]
                ),
                [Shipments],
                BLANK ()
            ) * [Shipments Saved_corrected]
        )
    ),
    [_2]
)
Shipments Saved_corrected =
VAR last_M_Shipments =
    DIVIDE (
        [Volume],
        CALCULATE (
            [Loadability volumetric],
            DATEADD (
                dDate[Date].[Date],
                -1,
                MONTH
            )
        ),
        BLANK ()
    )
RETURN
    IF (
        last_M_Shipments
            = BLANK (),
        BLANK (),
        SUMX (
            SUMMARIZE (
                dDate,
                dDate[Year],
                dDate[Month],
                "_1", last_M_Shipments - [Shipments]
            ),
            [_1]
        )
    )

If this is not working, create a sample dataset and replicate your issue. Then share those tables and expected outputs.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

2 REPLIES 2
nandukrishnavs
Super User
Super User

@Parthsh93 

 

Try this

loadability savings corrected =
SUMX (
    SUMMARIZE (
        dDate,
        dDate[Year],
        dDate[Month],
        "_2", IF (
            [Shipments Saved_corrected] = 0
                || BLANK (),
            BLANK (),
            DIVIDE (
                SUMX (
                    'Prototype Modeling_Freight',
                    'Prototype Modeling_Freight'[Load Charge]
                ),
                [Shipments],
                BLANK ()
            ) * [Shipments Saved_corrected]
        )
    ),
    [_2]
)
Shipments Saved_corrected =
VAR last_M_Shipments =
    DIVIDE (
        [Volume],
        CALCULATE (
            [Loadability volumetric],
            DATEADD (
                dDate[Date].[Date],
                -1,
                MONTH
            )
        ),
        BLANK ()
    )
RETURN
    IF (
        last_M_Shipments
            = BLANK (),
        BLANK (),
        SUMX (
            SUMMARIZE (
                dDate,
                dDate[Year],
                dDate[Month],
                "_1", last_M_Shipments - [Shipments]
            ),
            [_1]
        )
    )

If this is not working, create a sample dataset and replicate your issue. Then share those tables and expected outputs.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

@nandukrishnavs, Thank You very much. It has solved the issue.

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.