Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
LorenzoC
Regular Visitor

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

1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@LorenzoC 

output ; 

Daniel29195_0-1718611211713.png

 

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. 

View solution in original post

2 REPLIES 2
Daniel29195
Super User
Super User

@LorenzoC 

output ; 

Daniel29195_0-1718611211713.png

 

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. 

Yeah, it does work!
Thanks a lot

 

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.