Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Summarize multiple variables

Hi,

 

I need to calculate the standard hours per MFG_ORDER_NAME. This calculated value per individual line is OK, but the sum is incorrect. I tried summarize function but I need help ons this.

 

For HRS_STANDARD I calculated two variables, insteltijd and produktietijd. When I add those two at the return function, the calculation at line level is correct, however the total is incorrect. I tried SUMX(SUMMARIZE but I cannot select the two calculated variables when doing so. Can anyone help with the correct syntax?

 

  • I would probably go with something like:

     

    Measure Total =
    VAR __table = SUMMARIZE('Table',[MFG_ORDER_NAME],[DEPARTMENT],[BASIS],"__hrsStandard",[HRS STANDARD])
    VAR __total = SUMX(__table,[__hrsStandard])
    RETURN
    IF(HASONEVALUE([DEPARTMENT]),[HRS STANDARD],__total)

    You may have to modify the SUMMARIZE.

9 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable
      Thanks for your reply. I read your articles. Can you show how my calculation should look like?
      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        I would probably go with something like:

         

        Measure Total =
        VAR __table = SUMMARIZE('Table',[MFG_ORDER_NAME],[DEPARTMENT],[BASIS],"__hrsStandard",[HRS STANDARD])
        VAR __total = SUMX(__table,[__hrsStandard])
        RETURN
        IF(HASONEVALUE([DEPARTMENT]),[HRS STANDARD],__total)

        You may have to modify the SUMMARIZE.

  • Hi,

     

    Write this additional measure and drag this to the Table visual

     

    =IF(HASONEVALUE(MFG_ORDER_NAME),[HRS_STANDARD],SUMX(SUMMARIZE(VALUES([MFG_ORDER_NAME]),[MFG_ORDER_NAME],"ABCD",[HRS_STANDARD]),[ABCD]))

     

    Hope this helps.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ashish,

       

      Tried following extra measure and dragged it into the visual. Still total is incorrect

       

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

         

        Share the link from where i can download your PBI file.  Also, show the expected result in a tet box there.