Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Need help with a measure

Hello,

 

I need your help with a measure.

I want to sum of the amounts of 'kratten totaal' to be displayed but this not work with the following measure:

 

Kratten totaal = 
VAR KrattenTotaal = MAXX( VALUES( vwAanvoerPartijenPalletsEnLogs[AantalKratten]) ; vwAanvoerPartijenPalletsEnLogs[AantalKratten])

RETURN
IF( OR( [Brutogewicht totaal MS] = BLANK(); [Nettogewicht totaal MS] = BLANK()) ; BLANK() ; KrattenTotaal)

These are the measures of the brutogewicht and nettogewicht (that are correct):

 

Brutogewicht totaal MS = 
VAR Brutogewicht = SUMX( VALUES(vwAanvoerPartijenPalletsEnLogs[BrutoGewicht (1)]); vwAanvoerPartijenPalletsEnLogs[BrutoGewicht (1)])

RETURN
IF( Brutogewicht = BLANK() ; BLANK(); Brutogewicht)
Nettogewicht totaal MS = 
VAR Nettogewicht = SUMX( VALUES(vwAanvoerPartijenPalletsEnLogs[NettoGewicht (1)]); vwAanvoerPartijenPalletsEnLogs[NettoGewicht (1)])

RETURN
IF( Nettogewicht = BLANK() ; BLANK() ; Nettogewicht)

Sample data:

 

PalletID TimeOpgezet Bonnummer Opzetmachine Brutogewicht totaal MS Nettogewicht totaal MS Kratten totaal
53361 24-10-2018 18:07:52 114830 1 668,00 533,99 78
53362 24-10-2018 18:31:01 114830 1 685,50 552,94 78
53363 24-10-2018 19:08:05 114830 1 684,00 550,18 78
53364 24-10-2018 20:00:15 114830 1 686,00 553,74 78
53365 24-10-2018 20:34:20 114830 1 682,50 544,50 78
53390 25-10-2018 10:09:18 114830 2 679,50 668,32 78
53391 25-10-2018 10:22:15 114830 2 681,50 671,69 78
53392 25-10-2018 10:48:49 114830 2 687,50 665,32 78
53393 25-10-2018 11:01:19 114830 2 672,00 617,51 78
53394 25-10-2018 11:30:01 114830 2 674,00 532,18 78
53395 25-10-2018 11:41:39 114830 2 676,50 535,70 78
53396 25-10-2018 11:58:14 114830 2 703,50 568,50 78
53397 25-10-2018 12:23:03 114830 2 694,50 558,52 78

 

 

  • Hi Anonymous

    I notice that you use MAXX in the first measure, but you said you want the sum of the amounts of 'kratten totaal'.

    So may be you need to use SUMX instead of MAXX.

    MAXX evaluates an expression for each row of a table and returns the largest numeric value.

     

    Or if it is intended to use MAXX in the first measure, and what is wrong form the picture is only the sum value you circled.

    You could modify measure as below

    Kratten totaal = 
    VAR KrattenTotaal = MAXX( VALUES( vwAanvoerPartijenPalletsEnLogs[AantalKratten]) ; vwAanvoerPartijenPalletsEnLogs[AantalKratten])
    
    VAR SUM1=IF( OR( [Brutogewicht totaal MS] = BLANK(); [Nettogewicht totaal MS] = BLANK()) ; BLANK() ; KrattenTotaal)

    RETURN
    IF(HASONEVALUE(vwAanvoerPartijenPalletsEnLogs[PalletID]),SUM1,
    SUMX(VALUES( vwAanvoerPartijenPalletsEnLogs[AantalKratten]) ; vwAanvoerPartijenPalletsEnLogs[AantalKratten]))

     

    Best Regards

    Maggie

1 Reply

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous

    I notice that you use MAXX in the first measure, but you said you want the sum of the amounts of 'kratten totaal'.

    So may be you need to use SUMX instead of MAXX.

    MAXX evaluates an expression for each row of a table and returns the largest numeric value.

     

    Or if it is intended to use MAXX in the first measure, and what is wrong form the picture is only the sum value you circled.

    You could modify measure as below

    Kratten totaal = 
    VAR KrattenTotaal = MAXX( VALUES( vwAanvoerPartijenPalletsEnLogs[AantalKratten]) ; vwAanvoerPartijenPalletsEnLogs[AantalKratten])
    
    VAR SUM1=IF( OR( [Brutogewicht totaal MS] = BLANK(); [Nettogewicht totaal MS] = BLANK()) ; BLANK() ; KrattenTotaal)

    RETURN
    IF(HASONEVALUE(vwAanvoerPartijenPalletsEnLogs[PalletID]),SUM1,
    SUMX(VALUES( vwAanvoerPartijenPalletsEnLogs[AantalKratten]) ; vwAanvoerPartijenPalletsEnLogs[AantalKratten]))

     

    Best Regards

    Maggie