Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
So I have a table with a list of inspections, and then another related table with a list of all violations associated with the inspections. The inspection table and violation table are related via the report #.
Violation Table:
Report Number Violation Code Violation Points
1 1.3 2
1 1.8 3
1 1.3 2
2 12.4 1
2 7.5 5
What I am attempting to do on the Inspection Table is to create a calculated column with a SUM of the violation points for that report #. That's easy enough to do....
Inspection Points = CALCULATE(SUM('Violation Table'[violation points]))
BUT I want to filter out duplicate violation codes on each individual report #, so the inspection table would look like this... Total Inspection Points for Report #1 = 5 not 7.
Report Number Total Inspection Points
1 5
2 6
This isn't working for me.....
Inspection Points = CALCULATE(SUM('Violation Table'[violation points]), DISTINCT('Violation Table'[Violation Code])
Solved! Go to Solution.
Hi @benjaminlperry
You can use the below expression.
Total Inspection Points = SUMX( GROUPBY( 'Violation Table', 'Violation Table'[Report Number], 'Violation Table'[Violation Code], 'Violation Table'[ Violation Points] ), 'Violation Table'[ Violation Points] )
Hi @benjaminlperry
You can use the below expression.
Total Inspection Points = SUMX( GROUPBY( 'Violation Table', 'Violation Table'[Report Number], 'Violation Table'[Violation Code], 'Violation Table'[ Violation Points] ), 'Violation Table'[ Violation Points] )
I believe this works, but would it filter out duplicates of the same point value even if they have different violation codes? I wouldn't want duplicated point values filtered, just duplicate violation codes.
Hi @benjaminlperry
Group by will create a unique combination of all columns listed within it, so if there is a scenario like below it will count it as 4
Report Number Violation Code Violation Points
1 1.3 2
1 1.8 2
Hope this helps!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |