Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
1 year ago
Solved

Sum per Trade per Area

Hi good day can anyone help me on my calculated column, what i require is sum of weekly plan per Trade per Area.

DESIRED OUTPUT

 

Thank you

  • Hi AllanBerces 

    Can you please try the below dax ?

     

    Total_Trade =
    CALCULATE(
        SUM('Table'[Weekly Plan]),
        ALLEXCEPT('Table', 'Table'[Area], 'Table'[Trade])

    )


    If this answers your questions, kindly accept it as a solution and give kudos.

  • Hello AllanBerces,
    Thank you for reaching out to the Microsoft Fabric Community Forum.


    I have reproduced your scenario in Power BI Desktop using the exact structure you provided, and I was able to achieve the expected output by creating a calculated column that returns the sum of Weekly_Plan per Trade and Area.

     

    Steps I Followed:

    • Created a table with your data structure: Columns>> Area, Week No., Weekly_Plan, Trade
    • Added the following DAX Calculated Column:

    Total_Trade =

    CALCULATE(

        SUM('Table'[Weekly_Plan]),

        ALLEXCEPT('Table', 'Table'[Area], 'Table'[Trade])

    )

    • The output now shows the total Weekly_Plan grouped by both Area and Trade, exactly as you requested.

    Output:

    Please find the attached .pbix file that demonstrates the solution in action and also thanks to mdaatifraza5556 & amitchandak  for sharing valuable insights.

    Best Regards,
    Ganesh singamshetty.

5 Replies

  • Hi AllanBerces 

    Can you please try the below dax ?

     

    Total_Trade =
    CALCULATE(
        SUM('Table'[Weekly Plan]),
        ALLEXCEPT('Table', 'Table'[Area], 'Table'[Trade])

    )


    If this answers your questions, kindly accept it as a solution and give kudos.

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hello AllanBerces,
    Thank you for reaching out to the Microsoft Fabric Community Forum.


    I have reproduced your scenario in Power BI Desktop using the exact structure you provided, and I was able to achieve the expected output by creating a calculated column that returns the sum of Weekly_Plan per Trade and Area.

     

    Steps I Followed:

    • Created a table with your data structure: Columns>> Area, Week No., Weekly_Plan, Trade
    • Added the following DAX Calculated Column:

    Total_Trade =

    CALCULATE(

        SUM('Table'[Weekly_Plan]),

        ALLEXCEPT('Table', 'Table'[Area], 'Table'[Trade])

    )

    • The output now shows the total Weekly_Plan grouped by both Area and Trade, exactly as you requested.

    Output:

    Please find the attached .pbix file that demonstrates the solution in action and also thanks to mdaatifraza5556 & amitchandak  for sharing valuable insights.

    Best Regards,
    Ganesh singamshetty.

  • Hi,

    This calculated column formula works

    =calculate(sum(Data[weekly_plan]),filter(Data,Data[Area]=earlier(Data[Area])&&Data[Trade]=earlier(Data[Trade])))

    Hope this helps.