Forum Discussion
LorenzoC
2 years agoRegular Visitor
Measure does not work properly
Dear All, i have the following dataset: Id Date S_Cost D_Cost Tot_D_Cost 1 01/01/2024 500 1500 3300 1 01/01/2024 500 1800 3300 1 03/01/2024 2000 2500 2500 2 01/02/20...
- 2 years ago
Result = DIVIDE( SUM('Table'[D_Cost]) * SUMX( DISTINCT(ALLSELECTED('Table'[S_Cost])), [S_Cost] ), CALCULATE( SUM('Table'[D_Cost]), ALLEXCEPT( 'Table', 'Table'[Id] ) ) )
lbendlin
2 years agoSuper User
for your last row why is Tot_D_Cost lower than D_Cost?
What is the unique identifier for each row? If you don't provide one then you cannot use measures as Power BI automatically aggregates.
- LorenzoC2 years agoRegular Visitor
Dear lbendlin ,
you're right. The correct table is the following:
Id Date S_Cost D_Cost Tot_D_Cost DESIRED RESULT 1 01/01/2024 500 1500 3300 646,5517241 1 01/01/2024 500 1800 3300 775,862069 1 03/01/2024 2000 2500 2500 1077,586207 2 01/02/2024 500 2100 2100 692,3076923 2 02/02/2024 500 2800 2800 923,0769231 2 10/02/2024 2000 4200 4200 1384,615385 This however does not change my desired result.
- lbendlin2 years agoSuper User
Result = DIVIDE( SUM('Table'[D_Cost]) * SUMX( DISTINCT(ALLSELECTED('Table'[S_Cost])), [S_Cost] ), CALCULATE( SUM('Table'[D_Cost]), ALLEXCEPT( 'Table', 'Table'[Id] ) ) )