Forum Discussion
Sum measure with exclusion
- 2 years ago
Anonymous
is ths what you want?
1. create an index column in PQ
_flag = if(CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Name],'Table'[Month]))>1&&'Table'[Index]=CALCULATE(min('Table'[Index]),ALLEXCEPT('Table','Table'[Name],'Table'[Month])),1,0)_flag2 = if(CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Name],'Table'[Month]))>1,1) - 2 years ago
Hi
Enter this calculated column formula
Flag2 = if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Name]=EARLIER(Data[Name])&&Data[Month]=EARLIER(Data[Month])&&Data[Flag]=1))>0,1,BLANK())Hope this helps.
- Anonymous2 years ago
Hi Anonymous ,
Please try:Hours 2 = IF ( HASONEVALUE ( 'Table'[Name] ), [Hours], SUMX ( FILTER ( 'Table', NOT 'Table'[Month] IN CALCULATETABLE ( VALUES ( 'Table'[Month] ), 'Table'[Flag] = 1, ALLEXCEPT ( 'Table', 'Table'[Name] ) ) ), [Hours] ) )Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi Anonymous ,
Please try:
Hours 2 =
IF (
HASONEVALUE ( 'Table'[Name] ),
[Hours],
SUMX (
FILTER (
'Table',
NOT 'Table'[Month]
IN CALCULATETABLE (
VALUES ( 'Table'[Month] ),
'Table'[Flag] = 1,
ALLEXCEPT ( 'Table', 'Table'[Name] )
)
),
[Hours]
)
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group