Forum Discussion
Palmtop
Helper I
3 years agoSUMX Different Column Depending On IF Condition
Hello All, I am struggling with a measure that is trying to accomplish the following: I have a set of ID_Tasks attributed to ID_Project and I want to find the TotalSales by summing either Tot...
- 3 years ago
Palmtop
Sorry fo the late response. The problem is coming from the ALLSELECTED in the Duplicate measure. This has to be done manually.Total Sales = VAR SelectedTable = ALLSELECTED ( SalesProfiles ) RETURN SUMX ( SUMMARIZE ( SalesProfiles, ProjetList[ID_Project], ProjetList[ID_Task] ), IF ( CALCULATE ( COUNT ( SalesProfiles[ID_Project] ), SelectedTable, VALUES ( SalesProfiles[ID_Project] ) ) = 1, SUM ( SalesProfiles[TotalSalesSingle] ), SUM ( SalesProfiles[TotalSalesMulti] ) ) )
Palmtop
Helper I
3 years agoHi tamerj1 ,
Of course, please let me know if the link doesn't work.
https://1drv.ms/f/s!AndVpJp2VQectSrHRNEZnOIC2Kqj?e=CA0QS6
Thanks!
tamerj1
Community Champion
3 years agoPalmtop
Sorry fo the late response. The problem is coming from the ALLSELECTED in the Duplicate measure. This has to be done manually.
Total Sales =
VAR SelectedTable = ALLSELECTED ( SalesProfiles )
RETURN
SUMX (
SUMMARIZE ( SalesProfiles, ProjetList[ID_Project], ProjetList[ID_Task] ),
IF (
CALCULATE (
COUNT ( SalesProfiles[ID_Project] ),
SelectedTable,
VALUES ( SalesProfiles[ID_Project] )
) = 1,
SUM ( SalesProfiles[TotalSalesSingle] ),
SUM ( SalesProfiles[TotalSalesMulti] )
)
)