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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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