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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
paulsnet1986
Helper I
Helper I

Count of Unique Values Sold Each Day Based on Sales to Date + Running Total

I am badly in need of a measure in to take the data in Table 1 and represent it as displayed in table two. Essentially I need a measure that counts sales only when the sale is of an SKU that hasn't already been sold in a prior date in the table, and then a running total of the first measure. Completely lost, any help would be greatly appreciated. Thank you.

 

Table 1

paulsnet1986_1-1635820453269.png

Table 2

paulsnet1986_0-1635820437146.png

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Picture1.png

 

Unique SKU sales: =
VAR currentdate =
MAX ( Data[Date] )
VAR previousSKU =
CALCULATETABLE (
VALUES ( Data[SKU] ),
FILTER ( ALL ( Data ), Data[Date] < currentdate )
)
VAR currentSKU =
VALUES ( Data[SKU] )
VAR onlycurrentdateSKU =
EXCEPT ( currentSKU, previousSKU )
RETURN
IF ( HASONEVALUE ( Data[Date] ), COUNTROWS ( onlycurrentdateSKU ) + 0 )
 
Unique SKUs running total: =
VAR currentdate =
MAX ( Data[Date] )
RETURN
IF (
HASONEVALUE ( Data[Date] ),
CALCULATE (
COUNTROWS ( VALUES ( Data[SKU] ) ),
FILTER ( ALL ( Data ), Data[Date] <= currentdate )
)
)
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Picture1.png

 

Unique SKU sales: =
VAR currentdate =
MAX ( Data[Date] )
VAR previousSKU =
CALCULATETABLE (
VALUES ( Data[SKU] ),
FILTER ( ALL ( Data ), Data[Date] < currentdate )
)
VAR currentSKU =
VALUES ( Data[SKU] )
VAR onlycurrentdateSKU =
EXCEPT ( currentSKU, previousSKU )
RETURN
IF ( HASONEVALUE ( Data[Date] ), COUNTROWS ( onlycurrentdateSKU ) + 0 )
 
Unique SKUs running total: =
VAR currentdate =
MAX ( Data[Date] )
RETURN
IF (
HASONEVALUE ( Data[Date] ),
CALCULATE (
COUNTROWS ( VALUES ( Data[SKU] ) ),
FILTER ( ALL ( Data ), Data[Date] <= currentdate )
)
)
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Beautiful, thank you so much!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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