Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

dax remove duplicates except one

Hello Everyone 

 

Help me please!! I cannot look at it anymore.

 

I have a Table like this:

Table Errorcosts

Week Number of the yearErrorplaceCumulative Errorcosts 
1Sales100 
1Production300 
2Sales330 
2Production400 
2Production400 
3Production500 
3Sales530 
4Production600 
4Production600 
4Production600 
4Sales560 
5Production700 
5Production700 
5Sales670 
6Production800 
6Sales700 
7Production900 
7 Sales800 
7 Sales800 
7 Sales800 
8Production10000 
8 Sales900 
8 Sales900 

 

Now I want to show in a line chart the cumulative costs till the present week. Thats why I made a connection through week number of the year to a date dimension table (DimDates). I then want to be able to filter this chart in Sales or Production with a simple slicer but also see the cumulative total cost. 

 

My problem is I cannot change the Table because of other important data i didnt show in the example.

 

 So I tried to creat a measure:

 

Measure = CALCULATE(SUM('Errorcosts'[Cumulative Errorcosts]),Filter(ALLSELECTED(DimDates[Week number of the year]),DimDates[Week number of the year]<=MAX(DimDates[Week number of the year])))

 

But honestly I have no clue, because I don't need to sum up the cumulative costs 

 

kind regards 

 

colin

4 Replies

  • Anonymous , based on what I got

    Better create Errorplace as a new dimension and create like

    Measure = CALCULATE(SUM('Errorcosts'[Cumulative Errorcosts])
    ,Filter(ALLSELECTED(DimDates[Week number of the year]),DimDates[Week number of the year]<=MAX(DimDates[Week number of the year]))
    , filter( allselected(Errorplace) , Errorplace[Errorplace] =max(Errorplace[Errorplace]))
    )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you 

     

    but its not working the way I want to. Because of the sum in formula the graph in the linie chart is far to big i think.

  • Anonymous's avatar
    Anonymous
    Not applicable

    proud of th final result!

    Thanks for the help