Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ShaRaj
Frequent Visitor

how to convert calculated column measure to measure

hi
iam getting error while converting calculated  measure in to dax measure, i tried without earlier also.
 
max = MAXX(FILTER('Score Fact Table','Score Fact Table'[CalYear]=Earlier([CalYear]) && 'Score Fact Table'[Category]=Earlier([Category] ) && 'Score Fact Table'[Sub Category]= EARLIER('Score Fact Table'[Sub Category])),'Score Fact Table'[Value]) 
 
ThanksInAdvance
1 ACCEPTED SOLUTION

Hi, @ShaRaj ,

 

Please make sure whether you use this code to create a measure instead of a column.

As far as I know, you just need to change EARLIER() to MAX()/SUM() in measure. MAX() for text data and SUM() for number data.

max1 = 
MAXX (
    FILTER (
        'Score Fact Table',
        'Score Fact Table'[CalYear] = MAX ( [CalYear] )
            && 'Score Fact Table'[Category] = MAX ( [Category] )
            && 'Score Fact Table'[Sub Category] = MAX ( 'Score Fact Table'[Sub Category] )
    ),
    'Score Fact Table'[Value]
)

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
ShaRaj
Frequent Visitor

Hi ,

iam not getting  desired output. instead of taking max of each category for every year ,this returns max value  of that particular column

Hi, @ShaRaj ,

 

Please make sure whether you use this code to create a measure instead of a column.

As far as I know, you just need to change EARLIER() to MAX()/SUM() in measure. MAX() for text data and SUM() for number data.

max1 = 
MAXX (
    FILTER (
        'Score Fact Table',
        'Score Fact Table'[CalYear] = MAX ( [CalYear] )
            && 'Score Fact Table'[Category] = MAX ( [Category] )
            && 'Score Fact Table'[Sub Category] = MAX ( 'Score Fact Table'[Sub Category] )
    ),
    'Score Fact Table'[Value]
)

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@ShaRaj , try like

 

max = MAXX(FILTER(allselected('Score Fact Table'),'Score Fact Table'[CalYear]=max([CalYear])
&& 'Score Fact Table'[Category]=max([Category] )
&& 'Score Fact Table'[Sub Category]= max('Score Fact Table'[Sub Category])),
'Score Fact Table'[Value]) 

 

 

or

 

max = MAXX(FILTER(all('Score Fact Table'),'Score Fact Table'[CalYear]=max([CalYear])
&& 'Score Fact Table'[Category]=max([Category] )
&& 'Score Fact Table'[Sub Category]= max('Score Fact Table'[Sub Category])),
'Score Fact Table'[Value]) 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.