Forum Discussion

LorenzoC's avatar
LorenzoC
Regular Visitor
2 years ago
Solved

Measure won't work...

Dear All,

i have the following dataset:

IdDateS_CostD_CostTot_D_Cost
101/01/202450015003300
101/01/202450018003300
103/01/2024200025002500
201/02/202450021003300
202/02/202450028003300
210/02/2024200042002500

 

How can I find the sum of distinct value of S_Cost considering there is only one S_Cost for each Id and Date?

My desired result is:

IdDateS_CostD_CostTot_D_CostDesired result
101/01/2024500150033002500
101/01/2024500180033002500
103/01/20242000250025002500
201/02/2024500210021003000
202/02/2024500280028003000
210/02/20242000420042003000

 

Thank you

lorenzo

  • LorenzoC 

    output ; 

     

    try the following calculated column : 

    Column =
    var ds =
    CALCULATEtable(
        SUMMARIZE('Table','Table'[S_Cost],'Table'[Date]) ,
        ALLEXCEPT('Table','Table'[Id])
    )

    RETURN
    SUMX(
        ds,
        [S_Cost]
    )



     
    let me know if this helps. 

2 Replies

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    LorenzoC 

    output ; 

     

    try the following calculated column : 

    Column =
    var ds =
    CALCULATEtable(
        SUMMARIZE('Table','Table'[S_Cost],'Table'[Date]) ,
        ALLEXCEPT('Table','Table'[Id])
    )

    RETURN
    SUMX(
        ds,
        [S_Cost]
    )



     
    let me know if this helps.