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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.


Go to 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.


Go to 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

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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