The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a table in which I have a date, the associated week and the associated year as three columns. I would like to determine the max date for each week and for each year using PowerBI.
I tried the following code but I am getting the max date across entire column.
Solved! Go to Solution.
Here is a simple version of a calculated column using CALCULATE
Max Date Week =
VAR Y= [Fiscal Year]
VAR W= [Fiscal Week]
RETURN CALCULATE(MAX('Table'[Date]),All('Table'),'Table'[Fiscal Year]=Y,'Table'[Fiscal Week]=W)
If you don't like variables:
If you want to be more sophisticated you can use MAXX:
return maxx(filter('Table','Table'[Fiscal Week]=W && 'Table'[Fiscal Year]=Y),'Table'[Date])
Here is a simple version of a calculated column using CALCULATE
Max Date Week =
VAR Y= [Fiscal Year]
VAR W= [Fiscal Week]
RETURN CALCULATE(MAX('Table'[Date]),All('Table'),'Table'[Fiscal Year]=Y,'Table'[Fiscal Week]=W)
If you don't like variables:
If you want to be more sophisticated you can use MAXX:
return maxx(filter('Table','Table'[Fiscal Week]=W && 'Table'[Fiscal Year]=Y),'Table'[Date])