March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a dataset that looks like the following.
For each ID there is an Attribute which has a score. There is also a target 0-4 with a weighting.
I'm looking to create a visual with a differential view of the weighted target score and actual score.
My plan is to have columns to calculate these values, however I'm struggling to formulate the DAX for the columns after the ~ symbol.
I've tried Calculate/SUMX/Filters but can't get these to work as expected. Any help is much appreciated
ID | Attribute | Score | Target | Weighting | ~ | Sum(Target*Weight) | Diff |
1 | A1 | 4 | 0 | 0.2 | ~ | 2.6 | +1.4 |
1 | A1 | 4 | 1 | 0.2 | ~ | 2.6 | +1.4 |
1 | A1 | 4 | 2 | 0 | ~ | 2.6 | +1.4 |
1 | A1 | 4 | 3 | 0 | ~ | 2.6 | +1.4 |
1 | A1 | 4 | 4 | 0.6 | ~ | 2.6 | +1.4 |
1 | A2 | ... | ... | ... | ~ | ... | ... |
Hi @DaxBoi
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your data model and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
@DaxBoi - You said:
"For clarity, I'm looking to sum based on a number of attributes - such as ID, and Attribute. And then do a second calculation (finding the differential) based on the same attributes"
PBIX is attached under sig, Table (4)
So, 2 columns:
Sum Target Weight =
VAR __Table =
ADDCOLUMNS(
FILTER('Table (4)',[ID]=EARLIER([ID]) && [Attribute]=EARLIER([Attribute])),
"Product",[Target]*[Weighting]
)
RETURN
SUMX(__Table,[Product])
Diff =
VAR __Table =
ADDCOLUMNS(
FILTER('Table (4)',[ID]=EARLIER([ID]) && [Attribute]=EARLIER([Attribute])),
"Product",[Score]*[Weighting]
)
RETURN
SUMX(__Table,[Product]) - [Column]
@DaxBoi , As measures
new score = sumx(All(Table),[Target]*[Weighting])
or
new score = sumx(Allselected(Table),[Target]*[Weighting])
or
new score = calculate(sumx(Table,[Target]*[Weighting]),All(Table))
or
new score = calculate(sumx(Table,[Target]*[Weighting]),Allselected(Table))
diff = Sum(Table[Score]) -[new score]
As new column
new score = sumx(Table,[Target]*[Weighting]
diff = [Score] -[new score] //Both are column here
I think I wasn't clear in my question
The aim is to have a conditional sum that looks like this. The sum would be over the 5 total rows for
ID = 1 Attribute = A1
and then another sum over the rows for
ID = 1 Attribute = A2
and so on.
ID | Attribute | Score | Target | Sum(T*W) | Diff |
1 | A1 | 4 | (0-4) | 2.6 | +1.4 |
+4 | rows as | above | |||
1 | A2 | 3 | (0-4) | 3.5 | -0.5 |
+4 | rows | ||||
1 | A3 | 4 | (0-4) | 1 | +3.0 |
For clarity, I'm looking to sum based on a number of attributes - such as ID, and Attribute. And then do a second calculation (finding the differential) based on the same attributes
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |