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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
LorenzoC
Regular Visitor

Issue in defining a measure

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

 

Wha I need is define a MEASURE (or at least a calculated column) which splits the value of TOTAL DISTINCT S_Cost with reference to the Id and Date.

 

Firstly I created two measures: 

DISTINCT_S_Cost = SUMX(
    SUMMARIZE(
        'Tabella 3 (Foglio2)',
        'Tabella 3 (Foglio2)'[Id],
        'Tabella 3 (Foglio2)'[S_Cost]
    ),
    'Tabella 3 (Foglio2)'[S_Cost]
)
 
and 
 
DISTINCT_TOTAL_D_Cost = SUMX(
    SUMMARIZE(
        'Tabella 3 (Foglio2)',
        'Tabella 3 (Foglio2)'[Id],
        'Tabella 3 (Foglio2)'[Tot_D_Cost]
    ),
    'Tabella 3 (Foglio2)'[Tot_D_Cost]
)
 
Then I created the my FINAL MEASURE, which was supposed to give my desired result:
Final_Measure = DIVIDE(SUM('Tabella 3 (Foglio2)'[D_Cost]),[DISTINCT_TOTAL_D_Cost])* [DISTINCT_S_Cost]
 
However, this does not work.
 
The following are my wrong result with my final measure and my desired result which i cannot achieve:
IdDateS_CostD_CostTot_D_CostDESIRED RESULT
101/01/202450015003300646,5517241
101/01/202450018003300775,862069
103/01/20242000250025001077,586207
201/02/202450021003300692,3076923
202/02/202450028003300923,0769231
210/02/20242000420025001384,615385

 

Wrong result:

LorenzoC_0-1718475361957.png

 

 

Do you think I can adjust this final measure to reach my desired result?
Thank you a lot

Lorenzo

 

 

5 REPLIES 5
rajendraongole1
Super User
Super User

Hi @LorenzoC - Creating calculated columns for S_Cost and Tot_D_Cost per Id and Date

 

Calculated column for Total S cost distinct

Distinct_Total_S_Cost =
CALCULATE(
    SUM('Desired'[S_Cost]),
    ALLEXCEPT('Desired', 'Desired'[Id], 'Desired'[Date])
)

 

Another calculated column : 

Distinct_Total_D_Cost =
CALCULATE(
    SUM('Desired'[Tot_D_Cost]),
    ALLEXCEPT('Desired', 'Desired'[Id], 'Desired'[Date])
)

 

create a calculated column to calculate the the distinct totals as below:

 

Final_Result =
DIVIDE(
    'Desired'[D_Cost],
    'Desired'[Distinct_Total_D_Cost]
) * 'Desired'[Distinct_Total_S_Cost]

 

rajendraongole1_0-1718477645079.png

 

 

In report:

rajendraongole1_1-1718477771421.png

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Dear @rajendraongole1 ,

thank you a lot for your answer. Unfortunately what you achieved is my wrong result.

What I want to achieve through a measure or a calculated column is the following (Desired Result):

IdDateS_CostD_CostTot_D_CostDESIRED RESULT
101/01/202450015003300646,5517241
101/01/202450018003300775,862069
103/01/20242000250025001077,586207
201/02/202450021003300692,3076923
202/02/202450028003300923,0769231
210/02/20242000420025001384,615385

Hi @LorenzoC - Can you help to understand with one record how we are getting desired result 646.55 for 1 record?

 

IdDateS_CostD_CostTot_D_CostDESIRED RESULT
101/01/202450015003300646.5517241

 

I have applied with formula dividing D_Cost by S_Cost and Tot_D_Cost as multiply.

rajendraongole1_0-1718532430790.png

Desired_Result = DIVIDE([DC] * 100, [SC]) * DIVIDE([TDC], 100)
 
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Dear @rajendraongole1 ,

the formula i used (in excel) for obtaining my desired result is:

(D_Cost / SUM Distinct Tot_D_Cost) * SUM_Distinct S_Cost

 

which in table is:

IdDateS_CostD_CostTot_D_CostDESIRED RESULTFormula for DESIRED RESULT
101/01/202450015003300646,5517241(1500/5800)*2500
101/01/202450018003300775,862069(1800/5800)*2500
103/01/20242000250025001077,586207(2500/5800)*2500
201/02/202450021003300692,3076923(2100/9100)*3000
202/02/202450028003300923,0769231(2800/9100)*3000
210/02/20242000420025001384,615385(4200/9100)*3000

Hello @LorenzoC , 

Can you please explain how you calculated your desired result? To have better understanding of the filter context as your explanation is not so clear in the original post. 
Thank you.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.