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.
Hi,
Considering the example:
I would like to compute the sum of timeminutes column for the max value of version column within each idproject column (yellow cells) for each iddate. The result should be the one shown on the right table. What's the best way to do this with dax?
Thank you!
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
timeminutes expected result: =
VAR _maxversiontable =
GROUPBY (
Data,
Data[idproject],
"@maxversion", MAXX ( CURRENTGROUP (), Data[version] )
)
RETURN
IF (
HASONEVALUE ( Data[iddate] ),
CALCULATE (
SUM ( Data[timeminutes] ),
TREATAS ( _maxversiontable, Data[idproject], Data[version] )
)
)
Thank you @Jihwan_Kim !
Would this also work if the max depends on more than one column? For example if I need to consider for the max columns idproject, idcampaign, idemployee, etc?
Hi,
Thank you for your message. It works if the additional columns are included inside the measure.
Hi,
Please check the below picture and the attached pbix file.
timeminutes expected result: =
VAR _maxversiontable =
GROUPBY (
Data,
Data[idproject],
"@maxversion", MAXX ( CURRENTGROUP (), Data[version] )
)
RETURN
IF (
HASONEVALUE ( Data[iddate] ),
CALCULATE (
SUM ( Data[timeminutes] ),
TREATAS ( _maxversiontable, Data[idproject], Data[version] )
)
)