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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
lprbi
Advocate II
Advocate II

DAX: BUG? COUNT HOW MANY PRODUCTS I HAVE THRU ORDERS[DATE], EVEN WITHOUT SALES

Hi,

Using PowerBI I having a big trouble with a task that seems simple: I need giving accross time (ORDER[DATE]), count how many products I have inserted in my database, even with no sales. I have a column for that: PRODUCTS[DT_INSERT]. Tried some, this give a correct value in the first YEAR, and wrong in th others:

CALCULATE(
COUNT(PRODUCTS[PROD_ID]);
CROSSFILTER(PRODUCTS[PROD_ID];ORDER_ITENS[PROD_ID];None);
FILTER(VALUES(PRODUCTS[DT_INSERT]);DATEVALUE(PRODUCTS[DT_INSERT])<=DATEVALUE(ENDOFMONTH(LASTDATE(ORDERS[ORDER_DATE]))))
)

Using DATEVALUE or not have no effect.

The total should give 2169 in 2015.


Please helpUntitled.png

1 ACCEPTED SOLUTION

Count of products all-time: (probably equal to the number of rows in the Products table)
 
COUNTROWS(ALL(Products[ProductId]))
 
Running count of products, assuming there's a column that says the date it was added
 
    CALCULATE(
        COUNTROWS(VALUES(Products[ProductId])),
        ALL(Products),
        FILTER(ALL(Products), Products[AddedDate]<=MAX(Dates[Date])))

View solution in original post

2 REPLIES 2
lprbi
Advocate II
Advocate II

I succesfully counted. Importing the table PRODUCTS twice (without any relationships)...

Tried crossfilter all relations on PRODUCTS no luck.

Count of products all-time: (probably equal to the number of rows in the Products table)
 
COUNTROWS(ALL(Products[ProductId]))
 
Running count of products, assuming there's a column that says the date it was added
 
    CALCULATE(
        COUNTROWS(VALUES(Products[ProductId])),
        ALL(Products),
        FILTER(ALL(Products), Products[AddedDate]<=MAX(Dates[Date])))

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.