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
sibeck_77
Helper I
Helper I

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

@sibeck_77 

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

@sibeck_77 

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

@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?

@sibeck_77 

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

@Fowmy 

 

Unfortunately it does not display any values:

 

sibeck_77_0-1622031706036.png

 

Do you have any other ideas?

@sibeck_77 

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

@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.

@sibeck_77 

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

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

 

@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
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.