- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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/2024 | 500 | 2100 | 3300 |
2 | 02/02/2024 | 500 | 2800 | 3300 |
2 | 10/02/2024 | 2000 | 4200 | 2500 |
Wha I need is to define a MEASURE (if impossible through a measure, a calculated column is also accepted) which splits the value of TOTAL DISTINCT S_Cost with reference to the Id and Date.
Firstly I created two measures for defining the distinct S_cost and Total_D_Cost:
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 | 3300 | 692,3076923 |
2 | 02/02/2024 | 500 | 2800 | 3300 | 923,0769231 |
2 | 10/02/2024 | 2000 | 4200 | 2500 | 1384,615385 |
Do you think I can adjust this final measure to reach my desired result?
Thank you a lot
Lorenzo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Result = DIVIDE(
SUM('Table'[D_Cost])
* SUMX(
DISTINCT(ALLSELECTED('Table'[S_Cost])),
[S_Cost]
),
CALCULATE(
SUM('Table'[D_Cost]),
ALLEXCEPT(
'Table',
'Table'[Id]
)
)
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Result = DIVIDE(
SUM('Table'[D_Cost])
* SUMX(
DISTINCT(ALLSELECTED('Table'[S_Cost])),
[S_Cost]
),
CALCULATE(
SUM('Table'[D_Cost]),
ALLEXCEPT(
'Table',
'Table'[Id]
)
)
)

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
04-11-2024 11:28 PM | |||
03-06-2024 02:47 AM | |||
10-08-2024 07:43 AM | |||
05-15-2024 06:16 PM | |||
08-09-2024 07:53 AM |
User | Count |
---|---|
24 | |
13 | |
11 | |
10 | |
9 |
User | Count |
---|---|
18 | |
14 | |
14 | |
12 | |
11 |