Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Dear Gurus,
Appreciate your help in calculating the below sum 35 minus hours for any month that was flagged 1 at least once (-7 for January and -10 for April. So result should be 35-7-10 = 18
Name | Month | Hours | Flag |
Zackary Orr | January | 4 | 1 |
Zackary Orr | January | 2 | 0 |
Zackary Orr | January | 1 | 0 |
Zackary Orr | February | 8 | 0 |
Zackary Orr | March | 2 | 0 |
Faye Daniels | April | 5 | 1 |
Faye Daniels | April | 5 | 0 |
Faye Daniels | June | 4 | 0 |
Faye Daniels | July | 4 | 0 |
Total | 35 |
Solved! Go to Solution.
@Anonymous
is ths what you want?
1. create an index column in PQ
Proud to be a Super User!
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.
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
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
In other words, I would like to flag any person who was at least flagged once in a certain month
Name | Month | Hours | Flag | Flag2 |
Zackary Orr | January | 4 | 1 | 1 |
Zackary Orr | January | 2 | 0 | 1 |
Zackary Orr | January | 1 | 0 | 1 |
Zackary Orr | February | 8 | 0 | |
Zackary Orr | March | 2 | 0 | |
Faye Daniels | April | 5 | 1 | 1 |
Faye Daniels | April | 5 | 0 | 1 |
Faye Daniels | June | 4 | 0 | |
Faye Daniels | July | 4 | 0 | |
Total | 35 |
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.
@Anonymous
is ths what you want?
1. create an index column in PQ
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
64 | |
63 | |
52 | |
36 | |
36 |
User | Count |
---|---|
81 | |
71 | |
58 | |
45 | |
44 |