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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Good morning i´m trying to create a max column to set the following condition:
if the max date is the max date from the store, put a flag Y
In a measure i did this and worked well, but the user need use this flag as filter.
the measure created:
Flag Visited :=
VAR datemax = CALCULATE(MAX('Date'[Date]),FILTER(ALL('Execution Audit KPI'),'Execution Audit KPI'[Audit Store SK] = SELECTEDVALUE('Execution Audit KPI'[Audit Store SK])))
VAR flag = IF(datemax = SELECTEDVALUE('Date'[Date]) ,"Y","N")
return
flag
What i need: create the same condition done by measure but by a calculated column
My try:
Solved! Go to Solution.
Hi @Vnidias
In this case the easiest appraoch is to first create a YearMonth YYYMM integer data type column
YearMonth = YEAR ( 'exec audit'[Date] ) * 100 + MONTH ( 'exec audit'[Date] )
Then the formula would be
flagnova =
VAR maxdate =
CALCULATE (
MAX ( 'exec audit'[Date] ),
ALLEXCEPT (
'exec audit',
'exec audit'[Audit Store SK],
'exec audit'[YearMonth]
)
)
RETURN
IF ( 'exec audit'[Start Date SK] = maxdate, "Y", "N" )
Hi @Vnidias
please try
flagnova =
VAR maxdate =
CALCULATE (
MAX ( 'exec audit'[Date] ),
ALLEXCEPT ( 'exec audit', 'exec audit'[Audit Store SK] )
)
RETURN
IF ( 'exec audit'[Start Date SK] = maxdate, "Y", "N" )
At the following moment this filtered did partially correct.
When i have two dates in a same month works.
ex:
2022-01-10,
2022-01-15
He marks correct.
But when the store has more months visited like:
2022-01-10,
2022-01-15,
2022-02-20
Doesnt work properly.
He will put
2022-01-10, N
2022-01-15, N
2022-02-20, Y
What he should do for the same store ID
2022-01-10, N
2022-01-15, Y
2022-02-20, Y
Hi @Vnidias
In this case the easiest appraoch is to first create a YearMonth YYYMM integer data type column
YearMonth = YEAR ( 'exec audit'[Date] ) * 100 + MONTH ( 'exec audit'[Date] )
Then the formula would be
flagnova =
VAR maxdate =
CALCULATE (
MAX ( 'exec audit'[Date] ),
ALLEXCEPT (
'exec audit',
'exec audit'[Audit Store SK],
'exec audit'[YearMonth]
)
)
RETURN
IF ( 'exec audit'[Start Date SK] = maxdate, "Y", "N" )
User | Count |
---|---|
9 | |
8 | |
5 | |
4 | |
3 |