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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
gabriela_al1
Regular Visitor

Distinct items per day

Hi all,

I am trying to create a DAX measure that calculcates the new  items per day.That means,for each day,it should check if the item exist in the day before and if not,it is a new item and therefore should be counted.

Important note is that my model is DirectQuery and functions like EARLIER would not work :(.

This is what I have done so far,but this DAX measure is not optimal since there is a lot of itemnumbers that should be evaluated.

 

 

VAR CurrentDate = SELECTEDVALUE(All_checks[Date])
VAR PreviousDate = CurrentDate - 1
RETURN
    CALCULATE(
        COUNTROWS(
            FILTER(
                All_checks,
                All_checks[Date] = CurrentDate &&
                NOT (
                    All_checks[ITEMNUMBER] IN
                    CALCULATETABLE (
                        VALUES(All_checks[ITEMNUMBER]),
                        All_checks[Date] = PreviousDate
                    )
                )
            )
        )
    )

 

Any suggestions would be appreciated.Thank you in advance. 

2 ACCEPTED SOLUTIONS
Dangar332
Super User
Super User

hi, @gabriela_al1 

if you need only count of new item then take diference of item number bw present day and previous day

 

measure =
var a = SELECTEDVALUE(All_checks[Date])
var a = calculate(
          distinctcount(All_checks[ITEMNUMBER]),
           All_checks[date] = a
         )

var b = calculate(
          distinctcount(All_checks[ITEMNUMBER]),
           All_checks[date] = a-1
         )
return
a-b

View solution in original post

some_bih
Super User
Super User

Hi @gabriela_al1 

one of possible solution is to count rows in your Date / Calendar table like with DAX.DO example on link and picture below

Sorry, correct link is this

Your measure could be something like below 

CALCULATE (
COUNTROWS ( 'Date' ),
FILTER ( __table_dates_sales, [Sales] = BLANK () )

 

adjust your table names and other

 

some_bih_1-1704565722705.png

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

2 REPLIES 2
some_bih
Super User
Super User

Hi @gabriela_al1 

one of possible solution is to count rows in your Date / Calendar table like with DAX.DO example on link and picture below

Sorry, correct link is this

Your measure could be something like below 

CALCULATE (
COUNTROWS ( 'Date' ),
FILTER ( __table_dates_sales, [Sales] = BLANK () )

 

adjust your table names and other

 

some_bih_1-1704565722705.png

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Dangar332
Super User
Super User

hi, @gabriela_al1 

if you need only count of new item then take diference of item number bw present day and previous day

 

measure =
var a = SELECTEDVALUE(All_checks[Date])
var a = calculate(
          distinctcount(All_checks[ITEMNUMBER]),
           All_checks[date] = a
         )

var b = calculate(
          distinctcount(All_checks[ITEMNUMBER]),
           All_checks[date] = a-1
         )
return
a-b

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.