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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
rveerasamy
Helper III
Helper III

need to display latest order date with repective order ID

Hi,

rveerasamy_0-1676370119998.png

 

 

 

rveerasamy_1-1676370859036.png

 

I just want to display the latest date (14-04-2022) along with respective Order ID , but while selecting latest in Order ID Column its returning last column value of the that TagId. But actually it should display the Order ID for that date.

 

I enclosed the images for the reference purpose.

 

Please advice.

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @rveerasamy ,

 

It's because row context in your visual affects the result. I made an example and provide a solution for your reference.

Sample data:

vstephenmsft_0-1676536653949.png

If there is only a Group ID in the visual, the latest date will be returned grouped according to the Group ID.

vstephenmsft_1-1676537407154.png

If you add an index column at this time, then because of the row context, the result will appear as follows.

vstephenmsft_2-1676537460900.png

Here's the solution. You can create a measure as the visual-level filters.

Measure =
VAR _date =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Tag ID] = MAX ( 'Table'[Tag ID] ) )
    )
RETURN
    IF ( _date = MAX ( 'Table'[Date] ), 1 )

Put the measure into the visual-level filters and set up show items when the value is 1.

And set the Date field to Don't summarize.

vstephenmsft_3-1676538835256.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @rveerasamy ,

 

It's because row context in your visual affects the result. I made an example and provide a solution for your reference.

Sample data:

vstephenmsft_0-1676536653949.png

If there is only a Group ID in the visual, the latest date will be returned grouped according to the Group ID.

vstephenmsft_1-1676537407154.png

If you add an index column at this time, then because of the row context, the result will appear as follows.

vstephenmsft_2-1676537460900.png

Here's the solution. You can create a measure as the visual-level filters.

Measure =
VAR _date =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Tag ID] = MAX ( 'Table'[Tag ID] ) )
    )
RETURN
    IF ( _date = MAX ( 'Table'[Date] ), 1 )

Put the measure into the visual-level filters and set up show items when the value is 1.

And set the Date field to Don't summarize.

vstephenmsft_3-1676538835256.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

 

MAwwad
Super User
Super User

 

To display the latest date along with the respective Order ID, you can use the MAXX function in Power BI. Here's an example DAX formula you can use:

 

sqlCopy code
Latest Order Date = MAXX(GROUPBY(Orders, Orders[Order ID], "LatestOrderDate", MAX(Orders[Order Date])), [LatestOrderDate])
 

This formula groups the orders by Order ID and finds the maximum order date for each group. Then, it returns the maximum order date across all groups. You can add this formula to a new card or table in your report to display the latest order date with the respective order ID.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors