Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe 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
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)
| PriMKey | ItemID | OrderDate | MaxOrderdate |
| 1 | abc123 | 1/15/2021 | 1/31/2021 |
| 2 | abc123 | 1/15/2021 | 1/31/2021 |
| 3 | abc123 | 1/15/2021 | 1/31/2021 |
| 4 | def123 | 1/22/2021 | 2/16/2022 |
| 5 | def123 | 1/22/2021 | 2/16/2022 |
| 6 | def123 | 1/22/2021 | 2/16/2022 |
| 7 | def123 | 1/22/2021 | 2/16/2022 |
| 8 | efg123 | 4/10/2021 | 7/31/2021 |
| 9 | efg123 | 4/10/2021 | 7/31/2021 |
| 10 | efg123 | 4/10/2021 | 7/31/2021 |
| 11 | fgh123 | 11/30/2021 | 11/30/2021 |
| 12 | ghi123 | 12/22/2021 | 2/16/2022 |
| 13 | hij123 | 1/30/2022 | 2/16/2022 |
| 14 | hij123 | 1/30/2022 | 2/16/2022 |
| 15 | hij123 | 1/30/2022 | 2/16/2022 |
I hope to achieve two cross tabs (monthly & quarterly)
| jan | feb | march | apr | may | jun | jul | aug | sep | oct | nov | dec | |
| 2021 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 1 | 1 | 1 | 2 | 2 |
| 2022 | 3 | 3 |
| Q1 | Q2 | Q3 | Q4 | |
| 2021 | 2 | 2 | 2 | 3 |
| 2022 | 2 |
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
Any recommendations on how to resolve this please.
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Unique count item: =
CALCULATE (
DISTINCTCOUNT ( Data[ItemID] ),
FILTER (
Data,
MAX ( 'Calendar'[Date] ) >= Data[OrderDate]
&& MIN ( 'Calendar'[Date] ) <= Data[MaxOrderdate]
)
)
Hi,
Please check the below picture and the attached pbix file.
Unique count item: =
CALCULATE (
DISTINCTCOUNT ( Data[ItemID] ),
FILTER (
Data,
MAX ( 'Calendar'[Date] ) >= Data[OrderDate]
&& MIN ( 'Calendar'[Date] ) <= Data[MaxOrderdate]
)
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 38 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 68 | |
| 34 | |
| 33 | |
| 30 |