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.
Community,
I am in need of help on removing a duplicate row to deliver the correct calculation I am seeking. Any help with a DAX solution to this much appreciated. I have provided a sample of the issues below as well as a sample file.
In this sample I have 3 tables, they are;
Weightings, CarConfig, and ForceData
In the table below I have added columns representing elements of the 3 tables. The data has been filtered by "TestID" and "Weighted ID"
Also included in the table is a measure created to calculate the "Weighted Value" of the "Data" for each "Attitude ID".
The measure is:
In this example I would like to have the duplicate of the "Attitude ID" (in this case attitude ID 1) removed before the calculations are completed.
Also, I would like for the the "Weighted Value" to show the SUM of that column (this should be 16).
Below is a link to the PBIX file.
Thanks for any assistance offered!!
Solved! Go to Solution.
In order to easily identify rows which should be removed, create a new calculated column like this
repeatTestFlag = IF ( CarConfig[RunID] = CALCULATE ( MAX ( CarConfig[RunID] ); FILTER ( CarConfig; CarConfig[TestID] = EARLIER ( CarConfig[TestID] ) ) ); 1; 0 )
Then change the Weighted Value-measure to this:
Weighted Value = SUMX ( CarConfig; CALCULATE ( SUM ( ForceData[Data] ); CarConfig[repeatTestFlag] = 0 ) * CALCULATE ( MIN ( Weightings[Weighting] ); CarConfig[repeatTestFlag] = 0 ) )
This removes the repeated row from the calculation, if you want to remove it from the table as well, add the column repeatTestFlag to the visual filter-pane of the visual and remove the rows where repeatTestFlag=1
Hi @Anonymous,
[Attitude ID] = 1 occurs twice in your table because there are two different RunIDs for this [Attitude ID], 1 and 5, for your filter selection([TestID]=1,00 and [Weighted ID]=1). If you remove RunID from your visual, [Attitude ID] = 1 is no longer repeated. If this is not what you are looking for, could please state how you want to handle different RundIDs
cheers
In order to easily identify rows which should be removed, create a new calculated column like this
repeatTestFlag = IF ( CarConfig[RunID] = CALCULATE ( MAX ( CarConfig[RunID] ); FILTER ( CarConfig; CarConfig[TestID] = EARLIER ( CarConfig[TestID] ) ) ); 1; 0 )
Then change the Weighted Value-measure to this:
Weighted Value = SUMX ( CarConfig; CALCULATE ( SUM ( ForceData[Data] ); CarConfig[repeatTestFlag] = 0 ) * CALCULATE ( MIN ( Weightings[Weighting] ); CarConfig[repeatTestFlag] = 0 ) )
This removes the repeated row from the calculation, if you want to remove it from the table as well, add the column repeatTestFlag to the visual filter-pane of the visual and remove the rows where repeatTestFlag=1
Thanks!! This will work
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |