Forum Discussion

Abale's avatar
Abale
Frequent Visitor
3 years ago
Solved

Partition by logic in PowerBI

Hi Can someone help me to replicate this SQL logic into PowerBI.

 

DATA:

 

Company dateDetail RIDBIN RIDLIN RIDDetail sumBin SUMLIN SUM
1009/22/2022A123B222L111103030
1009/22/2022A124B223L111103030
1009/22/2022A125B224L1111030

30

 

Current OUTPUT IN POWERBI:

Company dateDetail sumBin SUMLIN SUM
1009/22/2022309090

 

Expected OUTPUT IN POWERBI :

 

Company dateDetail sumBin SUMLIN SUM
1009/22/2022303030

 

 

When i am taking data to powerBI, The Detail Sum id showing 30  and BIN and LIN also showing the sum based on their ID.

 

Please check above mentioned data and output. Help me to get right output by implementing parition logics in powerbi.  I want take the sum values ONLY for highest value of the BIN and LIN ID. 

 

I TRIED IN SQL, But i dont know how to implement in PowerBI.

 

 

 

Thank you

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Abale,

    Did the data table bin and lin field value aggregate with sum mode? If that is the case, you need to write a formula to use a variable with summarize function to aggregate table records at first.
    Then you can use the iterator function maxx to aggregate the variable table to get the max values from the summarized bin and link field values.

    Measure Totals, The Final Word 

    If not, you can directly right-click on these fields to use 'max' mode to aggregate the bin and lin field values.

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Abale,

    Did the data table bin and lin field value aggregate with sum mode? If that is the case, you need to write a formula to use a variable with summarize function to aggregate table records at first.
    Then you can use the iterator function maxx to aggregate the variable table to get the max values from the summarized bin and link field values.

    Measure Totals, The Final Word 

    If not, you can directly right-click on these fields to use 'max' mode to aggregate the bin and lin field values.

    Regards,

    Xiaoxin Sheng