Forum Discussion

Grahamwest's avatar
Grahamwest
Regular Visitor
8 years ago

Need help with formula

Hello Folks,

 

I got an example table with:

 

 

Batch                           Qty (Kg)          Auction no.

A1025                           5                                1

A1025                           5                                2

A1026                           4                                2

A1025                           5                                3

A1027                           7                                3

A1025                           5                                4

A1027                           7                                4

 

Now I want a new calculated table with:

 

If I select Any of the auction let say 2 so result should be:

 

Batch                           Qty (Kg)         

A1025                           5                               

A1026                           4                               

 

But if I select multiple auctions let say 1,2 & 3 so result should be: 

 

Batch                           Qty (Kg)         

A1025                           5                               

A1026                           4                               

A1027                           7                               

 

Which means I should not sum up instead gives me the unique value of each auction.

 

How to achieve this?

 

Best regards,

 

Graham

10 Replies

    • Grahamwest's avatar
      Grahamwest
      Regular Visitor

      Can it be done by using measure?

       

      I have almost reached at the end, but now the porblem is totals. See this:

       

      I tried doing it mathematically:

       

      -TotalOfferedforunique = DIVIDE(SUM('Live Auction'[Offered QTY]),COUNT('Live Auction'[Batch No]))

      -Distict Batch Count = DISTINCTCOUNT('Live Auction'[Batch No])

      -Unique Offered QTY (MT) = [TotalOfferedforunique]*[Distict Batch Count]

       

      Now the same formula is getting applied on its total, which I dont want. I want the sum of the columns.

       

      When I am exporting it in excel and adding up it is giving me the unique value but not when I am seeing it in BI.

       

      Thanks,

      Graham

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Grahamwest,

         

        Actually, you only need to switch the summary mode, then it will to show the distinct value.

         

        Notice: Summary mode 'Minimum', 'Maximum', 'Median', 'Average' suitable for your requirement.

         

        Measure version:

        Qty(Kg) = CALCULATE(LASTNONBLANK('sample'[ Qty (Kg)],[ Qty (Kg)]),ALLSELECTED('sample'[Auction no.]))

         

         

        Regards,

        Xiaoxin Sheng