Forum Discussion

Oliya's avatar
Oliya
Frequent Visitor
3 years ago
Solved

dax problem

Hi,
I am trying to solve a problem through dax. currently there is duplicate data in my table and requirement is not to delete the duplicate records because if the user filters based on country they should see the correct result. Sample data is below

Contract Novolumetypecountry
111110originalsingapore
111110reportingnetherland
222215originalvietnam


the o/p should be for contract no 1111 total volume should be 10. 
for singapore volume should be 10 similarly for netherland volume should show 10.

for both singapore and netherland volume should be 10. There can be max 2 lines of a contract(original,reporting) or 1.
how i can get the correct sum using dax?

  •  Hi, Oliya 

    According to your description, you want to get the total of the [volume] accoding to your logic.

    Here are the steps you can refer to :
    (1)My test data is the same as yours.

    (2)We can create two measures:

    Measure = MAXX('Table','Table'[volume])
    Measure 2 = SUMX(VALUES('Table'[Contract No]) ,[Measure])

    (3)Then we can put the [Measure 2] and the fields on the visual and then we can meet your need:

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

4 Replies

  •  Hi, Oliya 

    According to your description, you want to get the total of the [volume] accoding to your logic.

    Here are the steps you can refer to :
    (1)My test data is the same as yours.

    (2)We can create two measures:

    Measure = MAXX('Table','Table'[volume])
    Measure 2 = SUMX(VALUES('Table'[Contract No]) ,[Measure])

    (3)Then we can put the [Measure 2] and the fields on the visual and then we can meet your need:

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Oliya's avatar
    Oliya
    Frequent Visitor
    Spoiler
    The measure will be used in table with contract no and with country slicer.