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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Take last version number value

I want to make a report that shows only the value that is evident in the last version (yellow marked).

sibeck_77_0-1622019822347.png

I tried it with the follow DAX expressions:

 

Last Version No = CALCULATE(SUM(Verkaufsoffertenarchiv[Amount]),LASTNONBLANK(Verkaufsoffertenarchiv[Version_No],Verkaufsoffertenarchiv[Version_No]))
 
or
 
Max Version No =
MAXX(
    KEEPFILTERS(VALUES('Verkaufsoffertenarchiv'[Version_No])),
    CALCULATE(SUM('Verkaufsoffertenarchiv'[Version_No]))
)
 
Both expressions are not the solutions because I get the sum from all versions instead of showing only the latest value. 
I have the following columns available:
sibeck_77_1-1622020340985.png

 

 Could someone help me to reach this goal?
 

 

1 ACCEPTED SOLUTION

@Anonymous 

Please try this one:

Last Version No M = 
var __no = MAX(Verkaufsoffertenarchiv[No])
var __maxno =     
    MAXX( FILTER(  ALL(Verkaufsoffertenarchiv) ,  Verkaufsoffertenarchiv[No] = __no ) , Verkaufsoffertenarchiv[Version_No] )
return
    CALCULATE(
        SUM(Verkaufsoffertenarchiv[Amount]),
        Verkaufsoffertenarchiv[Version_No] = __maxno,
        Verkaufsoffertenarchiv[No] = __no
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

9 REPLIES 9
Fowmy
Super User
Super User

@Anonymous 

Try the following measure:

Last Version No = 
var __no = MAX(Verkaufsoffertenarchiv[Version_No])
var __maxno = 
    MAXX( ALLEXCEPT( Verkaufsoffertenarchiv , Verkaufsoffertenarchiv[No] ) , Verkaufsoffertenarchiv[Version_No] ) 
return
    CALCULATE(
        SUM(Verkaufsoffertenarchiv[Amount]),
        Verkaufsoffertenarchiv[Version_No] = __maxno,
        Verkaufsoffertenarchiv[No] = __no
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy  

 

Thanks for your quick response. Unfortunately, there is an error message:

 

Error Message:
MdxScript(Model) (12, 9) Calculation error in Measure 'Sales Offer Archive'[Last Version No]: DAX comparison operations do not support comparisons between values of type text and integer. You can use the VALUE function or the FORMAT function to convert one of the values.

 

Do you know what I have to change that your DAX expression is working?

@Anonymous 

Can you try now?

Last Version No = 
var __no = MAX(Verkaufsoffertenarchiv[No])
var __maxno = 
    MAXX( ALLEXCEPT( Verkaufsoffertenarchiv , Verkaufsoffertenarchiv[No] ) , Verkaufsoffertenarchiv[Version_No] ) 
return
    CALCULATE(
        SUM(Verkaufsoffertenarchiv[Amount]),
        Verkaufsoffertenarchiv[Version_No] = __maxno,
        Verkaufsoffertenarchiv[No] = __no
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy 

 

Unfortunately it does not display any values:

 

sibeck_77_0-1622031706036.png

 

Do you have any other ideas?

@Anonymous 

I created the same scenario and tested. 

Last Version No M = 
var __no = MAX(Verkaufsoffertenarchiv[No])
var __maxno = 
    MAXX( ALLEXCEPT( Verkaufsoffertenarchiv , Verkaufsoffertenarchiv[No] ) , Verkaufsoffertenarchiv[Version_No] ) 
return
    CALCULATE(
        SUM(Verkaufsoffertenarchiv[Amount]),
        Verkaufsoffertenarchiv[Version_No] = __maxno,
        Verkaufsoffertenarchiv[No] = __no
    )

My Table:

Fowmy_0-1622032961845.png

Result:

Fowmy_1-1622032976268.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy 

 

In my tests the result is that it takes the largest version no. and shows the amount just of this No. But it should be that it shows the amount of the largest version no. of every No.  

sibeck_77_0-1622033604198.png

 

Do you know what I mean?
In your test result it seems to be working... so I do not know what is wrong in my table.

@Anonymous 

Please try this one:

Last Version No M = 
var __no = MAX(Verkaufsoffertenarchiv[No])
var __maxno =     
    MAXX( FILTER(  ALL(Verkaufsoffertenarchiv) ,  Verkaufsoffertenarchiv[No] = __no ) , Verkaufsoffertenarchiv[Version_No] )
return
    CALCULATE(
        SUM(Verkaufsoffertenarchiv[Amount]),
        Verkaufsoffertenarchiv[Version_No] = __maxno,
        Verkaufsoffertenarchiv[No] = __no
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Dear @Fowmy 

 

I have a follow-up question.

When I create a table with your DAX, the total appears with 0. Do you know how this value also still shows the totals?

 

sibeck_77_0-1623852565679.png

 

Anonymous
Not applicable

@Fowmy  

Please excuse the long response time due to vacation absence.
Thanks for the adjustment, so it worked now.
Thanks again - awsome support!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors