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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ligalbert
Helper I
Helper I

How can i create a measure to count the number of orders a customer has done

I want to create a measure that tells me which number of order the customer currently has. for instance for customer 599-9175 he has two orders the new measure would tell me 1 for his first order and 2 for the second order. Please see the picture for visual understanding, I will be using powerbi to create such measure. thank you

real.PNG

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi, 

 

you're likely going to want to create a running total grouped on the ID field:

 

try something like this:

 

Running Total (m) =
    CALCULATE (
        SUM  ('Table (3)'[Order Count]),
        FILTER (
        ALLEXCEPT ('Table (3)','Table (3)'[ID]),
        'Table (3)'[Order Date] <= MAX ('Table (3)'[Order Date])))
 
DOLEARY85_0-1690906577433.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @ligalbert 

You can refer to the following measure

Measure = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Customer]),'Table'[Date]<=SELECTEDVALUE('Table'[Date]))

vxinruzhumsft_0-1691030170837.png

Best Regards!

Yolo Zhu

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

 

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi, 

 

you're likely going to want to create a running total grouped on the ID field:

 

try something like this:

 

Running Total (m) =
    CALCULATE (
        SUM  ('Table (3)'[Order Count]),
        FILTER (
        ALLEXCEPT ('Table (3)','Table (3)'[ID]),
        'Table (3)'[Order Date] <= MAX ('Table (3)'[Order Date])))
 
DOLEARY85_0-1690906577433.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.