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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How can i write dax for same version no for max line no and vice verse

How can i write dax for same version no for max line no.
and 
How can i write dax for different version no for same line no.
 

Hi Everybody,

 

I want to add the yellow line mark amount. How to do it in dax. Is there anyone to help me.

 

mzislam23_0-1678099334189.png

 

2 REPLIES 2
Anonymous
Not applicable

This is not working properly. there is both condition which is should be one value.

MAwwad
Solution Sage
Solution Sage

 

To get the amount for the maximum line no for each version, you can use the following DAX formula:

 

 
Max Line Amount = CALCULATE( SUM('Table'[Amount]), FILTER( 'Table', 'Table'[Version No] = EARLIER('Table'[Version No]) && 'Table'[Line No] = MAX('Table'[Line No]) ) )
 

Here, we are using the CALCULATE function to filter the table based on two conditions - same version no and maximum line no. The EARLIER function is used to refer to the current row in the filter context, and the MAX function is used to get the maximum line no for the current version. Finally, we sum up the Amount column for the filtered rows.

To get the amount for different version nos for the same line no, you can use the following DAX formula:

 

 
Same Line Amount = CALCULATE( SUM('Table'[Amount]), FILTER( 'Table', 'Table'[Line No] = EARLIER('Table'[Line No]) && 'Table'[Version No] <> EARLIER('Table'[Version No]) ) )
 

Here, we are using the CALCULATE function to filter the table based on two conditions - same line no and different version no. The EARLIER function is used to refer to the current row in the filter context, and the <> operator is used to check for inequality between version nos. Finally, we sum up the Amount column for the filtered rows.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors