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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
New_be
Helper V
Helper V

Wrong total

Hi,

I wanted to have totals of 7900 instead of 9061 for measure 'Passes output test'. But instead I got 9061. Can you please help? Below is my measure:

Passes output test =

VAR NormalPassValue =
    CALCULATE(
        SUM('SURFACE TREATMENT MOVEMENTS'[VALUE]),
        FILTER(
            'SURFACE TREATMENT MOVEMENTS',
            'SURFACE TREATMENT MOVEMENTS'[Num. Re-ST] = "Normal pass" &&
            'SURFACE TREATMENT MOVEMENTS'[Actual ST Only] = "TRUE"
        )
    )

VAR Rerun1xValue =
    CALCULATE(
        SUM('SURFACE TREATMENT MOVEMENTS'[VALUE]),
        'SURFACE TREATMENT MOVEMENTS'[Num. Re-ST] = "Re-ST 1x" && 'SURFACE TREATMENT MOVEMENTS'[Actual ST Only] = "TRUE",
        ALLEXCEPT('SURFACE TREATMENT MOVEMENTS', 'SURFACE TREATMENT MOVEMENTS'[Num. Re-ST], 'SURFACE TREATMENT MOVEMENTS'[PRD_ORDERID], 'SURFACE TREATMENT MOVEMENTS'[UNIT], 'SURFACE TREATMENT MOVEMENTS'[Actual ST Only])
    )

VAR AllPassesValue =
    CALCULATE(
        SUM('SURFACE TREATMENT MOVEMENTS'[VALUE]),
        FILTER(
            'SURFACE TREATMENT MOVEMENTS',
            'SURFACE TREATMENT MOVEMENTS'[Actual ST Only] = "TRUE"
        )
    )

VAR __Switch =
    SWITCH(
        TRUE(),
        SELECTEDVALUE('SURFACE TREATMENT MOVEMENTS'[Num. Re-ST]) = "Normal pass", NormalPassValue - Rerun1xValue,
        [Passes output]
    )

VAR Result = IF(AllPassesValue = BLANK(), BLANK(), __Switch)

RETURN Result


Here is my table:
YearWeekPROCESSMACHINEPRD_ORDERIDActual ST OnlyNum. Re-STGRADINGUNITVALUETotal Normal PassRerun 1xPasses outputPasses output test
Y24W34ST1ST17725354FALSENormal passCSQFT5372.98 1161  
Y24W34ST1ST17725354TRUENormal passC Hitam SapSQFT7225.92722611617225.926065.1
Y24W34ST1ST17725354FALSENormal passC SapSQFT1178.05 1161  
Y24W34ST1ST17725354TRUERe-ST 1xC Hitam SapSQFT1160.82 11611160.821160.82
Y24W34ST1ST17725354TRUERe-ST 2xC Hitam SapSQFT674.91 1161674.91674.91
           9061.659061.65
            7900.83
1 ACCEPTED SOLUTION
v-kaiyue-msft
Community Support
Community Support

Hi @New_be ,

 

You can try this measure.

Correct total = 
IF (
    ISINSCOPE ( 'SURFACE TREATMENT MOVEMENTS'[YearWeek] ),
    [Passes output test],
    SUMX (
        ALLEXCEPT (
            'SURFACE TREATMENT MOVEMENTS',
            'SURFACE TREATMENT MOVEMENTS'[YearWeek]
        ),
        [Passes output test]
    )
)

vkaiyuemsft_0-1724913319186.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-kaiyue-msft
Community Support
Community Support

Hi @New_be ,

 

You can try this measure.

Correct total = 
IF (
    ISINSCOPE ( 'SURFACE TREATMENT MOVEMENTS'[YearWeek] ),
    [Passes output test],
    SUMX (
        ALLEXCEPT (
            'SURFACE TREATMENT MOVEMENTS',
            'SURFACE TREATMENT MOVEMENTS'[YearWeek]
        ),
        [Passes output test]
    )
)

vkaiyuemsft_0-1724913319186.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

rajendraongole1
Super User
Super User

Hi @New_be - Can you check the below measure, i have modified as per data.  replace with your tablename

 

Passes output test2 =
VAR TotalNormalPass =
    CALCULATE(
        SUM('Totalb'[VALUE]),
        'Totalb'[Actual ST Only] = "TRUE",
        'Totalb'[Num. Re-ST] = "Normal pass"
    )

VAR TotalReST1x =
    CALCULATE(
        SUM('Totalb'[VALUE]),
        'Totalb'[Actual ST Only] = "TRUE",
        'Totalb'[Num. Re-ST] = "Re-ST 1x"
    )

VAR TotalReST2x =
    CALCULATE(
        SUM('Totalb'[VALUE]),
        'Totalb'[Actual ST Only] = "TRUE",
        'Totalb'[Num. Re-ST] = "Re-ST 2x"
    )

VAR AdjustedNormalPass =
    TotalNormalPass

VAR TotalPassesOutput =
    AdjustedNormalPass + TotalReST2x

RETURN
    TotalPassesOutput
 
rajendraongole1_0-1724783200390.png

 

 

Hope this helps.

 





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

Proud to be a Super User!





Hi @rajendraongole1 ,
Thank you for replying.
But yours is correct, mine is not correct:

New_be_0-1724817727998.png

 

Hi @New_be - you can update the measure as shared, you will definitely get the output as expected. 

still any , please upload your pbix file in drive will check.





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

Proud to be a Super User!





Hi @rajendraongole1 ,
Thank you for your help. Here is the link  to my sample report -> https://we.tl/t-Fa4wxK6or4

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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