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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Choosing Earliest User for the Total Orders Keyed by Users Count

Hello,

My Sales Transaction Table is something like this. I'm trying to chart out the percentile of Orders keyed by Users.

Order No Line No User Date Updated Time Updated
1231A01 January 202210:00:00
1231A02 January 202210:01:56
1232B02 January 202210:05:11
1235B02 January 202210:12:23
1233C02 January 202210:10:35
1234C02 January 202210:10:56
1242A02 January 202214:14:12
1242A02 January 202214:23:24
1243A02 January 202215:00:01
1244B02 January 202215:12:45
1241C02 January 202214:12:00

 

The total number of Orders is 2. Each Order has multiple Users. 

So even when I want total orders by Users, It counts the same Order number multiple times.

8048237_0-1662997464847.png

I only want to count the earliest User for an Order.
Example: In the Data, For Order No 123, User A was the earliest, and for 124, User C was the earliest. 

 

So the graph should show 2 orders, 1 for A and C each. How can I do this in DAX?

Thank you in advance for any help!

 

 

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

One option is to add a calculated column to identify the earliest row per order

Rank = 
RANKX(
    FILTER('Sales Transactions', 'Sales Transactions'[Order No] = EARLIER('Sales Transactions'[Order No]) ),
    'Sales Transactions'[Date Updated] + 'Sales Transactions'[Time Updated],
    ,
    ASC
    )

 

then a measure can use that Rank column to select the earliest user only

Order Count = 
CALCULATE(
    COUNTROWS('Sales Transactions'),
    KEEPFILTERS('Sales Transactions'[Rank] = 1)
)

View solution in original post

1 REPLY 1
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

One option is to add a calculated column to identify the earliest row per order

Rank = 
RANKX(
    FILTER('Sales Transactions', 'Sales Transactions'[Order No] = EARLIER('Sales Transactions'[Order No]) ),
    'Sales Transactions'[Date Updated] + 'Sales Transactions'[Time Updated],
    ,
    ASC
    )

 

then a measure can use that Rank column to select the earliest user only

Order Count = 
CALCULATE(
    COUNTROWS('Sales Transactions'),
    KEEPFILTERS('Sales Transactions'[Rank] = 1)
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.