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
joshua1990
Post Prodigy
Post Prodigy

Count last Entry per Order

Hello!

I have 2 tables:

The first table (Sales Header) contains some basic information on order level. That means one row per order:

Order-NrDateValue
25801.02.202150
93813.12.202250

 

Then I have the Sales Details table, which contains several rows per order:

 

Order NrStepQuantity
2580150
2580250
2580350
2580450
2580550
9380150

 

Now I would like to get just the last entry per order.

Something like:

 0102030405
258    1
9381    

 

How would you do that using DAX Measures?

 

 

4 REPLIES 4
Anonymous
Not applicable

try this
Column =
var maxValue =
CALCULATE (
MAX ( 'Table (2)'[steps] ),
ALLEXCEPT ( 'Table (2)', 'Table (2)'[order] )
)
return
if ('Table (2)'[steps]=maxValue , 1)p3.png

 

@Anonymous : Thanks, that works fine! What is, if a need a sub/ grand total? Then this measure will not work, right? I guess I need a countrows. How would you do that?

Anonymous
Not applicable

@joshua1990 From the visualization pane, go to the FORMAT of visual, and from there, you can keep the google buttons ON for subtotal. Pls, look at the Screenshots I have added.

Pls approve my reply and let me know if you have any further queries!p4.pngp5.png

jameszhang0805
Resolver IV
Resolver IV

Please try:

VAR _max = CALCULATE( MAX( 'Table'[Step] ) , ALLEXCEPT( 'Table' , 'Table'[Order Nr] ) )
RETURN IF( MAX( 'Table'[Step] ) = _max , 1 )

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.

Top Solution Authors