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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
PBI5851
Helper V
Helper V

Rolling counts-ish

hello,

with the below data, i am trying to count how many unique items per month/quarter were open (i.e they must fall between orderdate and maxorderdate)

 

PriMKeyItemIDOrderDateMaxOrderdate
1abc1231/15/20211/31/2021
2abc1231/15/20211/31/2021
3abc1231/15/20211/31/2021
4def1231/22/20212/16/2022
5def1231/22/20212/16/2022
6def1231/22/20212/16/2022
7def1231/22/20212/16/2022
8efg1234/10/20217/31/2021
9efg1234/10/20217/31/2021
10efg1234/10/20217/31/2021
11fgh12311/30/202111/30/2021
12ghi12312/22/20212/16/2022
13hij1231/30/20222/16/2022
14hij1231/30/20222/16/2022
15hij1231/30/20222/16/2022

 

I hope to achieve two cross tabs (monthly & quarterly)

 janfebmarch aprmayjunjulaugsepoctnovdec
2021211222211122
202233          

 

 Q1Q2Q3Q4
20212223
20222   

 

Ex: For 2021 Apr - i am counting def123 and efg123

For 2021 Nov - I am counting def123, fgh123. 

 

For Q4 of 2021- I am counting def123, fgh123 and ghi123. 

 

P.S on the MaxOrderdate, its basically today(). I am trying to use 

UniqueitemCount = CALCULATE( DISTINCTCOUNT('Table'[itemID]), FILTER('Table', 'Table'[Maxorderdatedate].[Date] < ALLSELECTED(Datetable[Date].[Date])))

 

Any recommendations on how to resolve this please. 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Picture1.png

 

Unique count item: =
CALCULATE (
DISTINCTCOUNT ( Data[ItemID] ),
FILTER (
Data,
MAX ( 'Calendar'[Date] ) >= Data[OrderDate]
&& MIN ( 'Calendar'[Date] ) <= Data[MaxOrderdate]
)
)

 


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

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 count item: =
CALCULATE (
DISTINCTCOUNT ( Data[ItemID] ),
FILTER (
Data,
MAX ( 'Calendar'[Date] ) >= Data[OrderDate]
&& MIN ( 'Calendar'[Date] ) <= Data[MaxOrderdate]
)
)

 


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

amitchandak
Super User
Super User

@PBI5851 , Refe blog on similar topic

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

File use example with active join to date table

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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