Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
In the flag column I would like to see 1 (or true / false) if the date is between the start and enddate. The startdate is based on the Quantity column, if the quantity is larger then 12, the next 12 months needs to be flagged.
Who can come up with a solution?
Hi @Anonymous
please try
flag column =
VAR CurrentDate = 'Table'[Date]
VAR CurrentStart = 'Table'[Date_start]
VAR CurrentEnd = 'Table'[Date_end]
VAR StartDate = CurrentDate - 365
VAR TableBefore =
FILTER ( 'Table', 'Table'[Date] <= CurrentDate && 'Table'[Date] >= StartDate )
VAR MatchingRecords =
FILTER (
TableBefore,
'Table'[Date] >= CurrentStart
&& 'Table'[Date] <= CurrentEnd
)
VAR Quantity =
MAXX ( MatchingRecords, 'Table'[Quantity] )
RETURN
IF (
CurrentDate >= CurrentStart
&& CurrentDate <= CurrentEnd,
1,
IF ( Quantity >= 12, 1 )
)
Hi @tamerj1
Only thing missing are the flags I added in red. From 21-7-2022 untill 21-7-2023 every row should get a flag because from the month the quantity > 12 every row needs a flag until the date_end.
@Anonymous Try:
flag column =
VAR __Date = [Date]
VAR __Start = MAXX(FILTER('Table',[Quantity]>12 && [Date]<=__Date),[Date_start])
VAR __End = MAXX(FILTER('Table',[Quantity]>12 && [Date]<=__Date),[Date_end])
RETURN
IF(__Date <= __End && __Date >= __Start),1,BLANK())
Hi Greg,
Thanks for the quick reply. The flags in green are correct, but the red ones are not. Can't figure out why they are flagged..
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 44 | |
| 40 | |
| 21 | |
| 18 |