Forum Discussion
Error in Grand Total, Selected Value Returning Wrong Total when 'Select ALL' is Clicked
- Anonymous2 years ago
Hi Anonymous ,
Based on the information you have provided, the issue with metrics not being updated correctly appears to be related to how the function is interpreted in the slicer context. Please consider modifying all filters in the metrics clearing table except for the filters to be retained:
Distribution X = VAR TotalMV = CALCULATE ( COUNTROWS ( 'Project Matching' ), ALL ( 'Project Matching'[MV.Vendor Name] ) ) VAR SelectedMV = COUNTROWS ( ALLEXCEPT ( 'Project Matching', 'Project Matching'[Project Name], 'Project Matching'[State], 'Project Matching'[Vendor] ) ) RETURN IF ( TotalMV = SelectedMV, TotalMV, SelectedMV )
The issue of totals not being aggregated correctly is a common problem in Power BI, especially when working with complex calculations that need to be aggregated in different ways at the total level. You can use this function on a table that follows the current filter context and then perform row-level calculations in that context:NR Cost = SUMX ( VALUES ( 'Project Matching'[Project Name] ), VAR mv_rate = [MV Rate] * [Hrs_Alloc] RETURN IF ( ISBLANK ( mv_rate ) || mv_rate = 0, [Cost W Inflation] / [Distribution X], mv_rate ) )How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Based on the information you have provided, the issue with metrics not being updated correctly appears to be related to how the function is interpreted in the slicer context. Please consider modifying all filters in the metrics clearing table except for the filters to be retained:
Distribution X =
VAR TotalMV =
CALCULATE (
COUNTROWS ( 'Project Matching' ),
ALL ( 'Project Matching'[MV.Vendor Name] )
)
VAR SelectedMV =
COUNTROWS (
ALLEXCEPT (
'Project Matching',
'Project Matching'[Project Name],
'Project Matching'[State],
'Project Matching'[Vendor]
)
)
RETURN
IF ( TotalMV = SelectedMV, TotalMV, SelectedMV )
The issue of totals not being aggregated correctly is a common problem in Power BI, especially when working with complex calculations that need to be aggregated in different ways at the total level. You can use this function on a table that follows the current filter context and then perform row-level calculations in that context:
NR Cost =
SUMX (
VALUES ( 'Project Matching'[Project Name] ),
VAR mv_rate = [MV Rate] * [Hrs_Alloc]
RETURN
IF (
ISBLANK ( mv_rate )
|| mv_rate = 0,
[Cost W Inflation] / [Distribution X],
mv_rate
)
)
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous2 years agoNot applicable
Good morning @v-yifanw-msft
Unfortunately the measures you suggested did not work (please see image with Distribution X2 and NR Cost 2 as the new measures.)My goal is take out the tendency of the measure returning the wrong number once 'select all' is clicked by the user in the MV. Vendor Name Slicer.For the NR Cost, it seems that we happen to almost the same logic, but the grand total is still not correct.For more context I upload the PBIX file and the ref data in this link: https://drive.google.com/drive/u/1/folders/1jrzCzmXR7zcFNk5gR4KM5L9VGGHLufbqI appreciate your help! Thank you so much😭