Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Guys,
I am struggling with a scenrio,Where i am creating a trend chart for rolling 12 month,I need to consider Distinct count of customers for last 12 months (For April 2023 i.e. May 2022-April 2023 & March 2023 i.e. April 2022-March 2023 ) and also check if the number of distinct product against those customers to be >= 2.
Kindly find below given data and output required
Output required (Distinct Customers(Product is >=2))
For Feb-23 count is 1,As only Cust ID 6 has Distinct Product Count >=2
For Dec2022 the count should be 2,As Cust ID 6&10 got Distinct Product Count >=2
Measure for distinct customer is
Running Count For 12 Months =
Var start_date = Max(TrxTable[Month])
Var MAX = Max(TrxTable[Month])
var MINI = datevalue(Month(EDATE(MAX,-11)) & "/1/" &Year(EDATE(MAX,-11)))
return
CALCULATE(DISTINCTCOUNT(TrxTable[Cust ID]),FILTER(All(TrxTable),TrxTable[TrxDate]<=MAX && TrxTable[TrxDate]>=MINI))
I am currently struggling with Distinct Customers(Product count is >=2) where i would be requireing nested aggr
Solved! Go to Solution.
Hi,
You may download my PBI file from here.
Hope this helps.
You are welcome.
Hi,
You may download my PBI file from here.
Hope this helps.
Could you please guide how i can add one more filter,Where i want to check if the customer got Product count >=2 this year and last year.
Eg:For April 2023 i.e. Check if the Product count is >=2 for individual customer within May 2022-April 2023
and also for the same customer the Product count is >=2 for May 2021-April2022
Hi,
Try this measure
Measure = if([Customer count]=BLANK(),BLANK(),COUNTROWS(FILTER(SUMMARIZE(CALCULATETABLE(VALUES(Data[Cust ID]),DATESBETWEEN('Calendar'[Date],EDATE(MIN('Calendar'[Date]),-23),MAX('Calendar'[Date]))),Data[Cust ID],"ABCD",CALCULATE([Products bought],DATESBETWEEN('Calendar'[Date],EDATE(MIN('Calendar'[Date]),-11),MAX('Calendar'[Date]))),"EFGH",CALCULATE([Products bought],DATESBETWEEN('Calendar'[Date],EDATE(MIN('Calendar'[Date]),-23),edate(MAX('Calendar'[Date]),-12)))),[ABCD]>=2&&[EFGH]>=2)))
Thanks,Let me give a try
Thanks a lot for your time and efforts Mate!!!!It Worked
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |