Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi, can anyone help me to understand what logic I need to apply to my existing table in order to return correct data?
Example table with underlying data called 'Table 1';
This is my current visual/table created in Power BI based on the above table with the date slicer to return data for Quarter 3 only;
I need to return the count of distinct postcodes with the time period (Q3) BUT I need to check the previous years' (12 months) data that returned postcodes and if the specific postcodes were queried within 12 months before the start date of Q3 (1st July21), we need to exclude those from the total count for Q3.
Just to give you a better context:
I need to bill my clients quarterly based on the number of calls they make, BUT I don't want to charge them for duplicate calls (postcodes) that were made in the past 12 months before the start date of the quarter.
e.g. client 'ABC ltd' had a total of 73 calls in Q3 but i don't want to charge them for all 73 calls, I want to charge them for unique (distinct) postcodes/calls compared with the past 12 months before start of Q3 (from 1st July 2020 to July 2021). This way we would only charge them for the first search of the postcode each time they search it in a year. Hope that makes sense.
Does anyone have any idea how to make this work? I guess I need to get all calls/postcodes from the quarter I am doing plus the 12 of calls/postcodes prior to that quarter and then return the distinct count of postcodes from that quarter with removed postcodes that were included in the 12 months prior data. How to do that?
Thanks,
Solved! Go to Solution.
Hi, @Anonymous ;
I create a simple test file. and create a measure as follow:
Measure =
COUNTROWS(EXCEPT(VALUES('Table'[ID]),
SUMMARIZE(FILTER(ALL('Table'),
[Date]<=MIN('Table'[Date])&&[Date]>=EDATE(MIN('Table'[Date]),-12)),[ID])))
the final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
I create a simple test file. and create a measure as follow:
Measure =
COUNTROWS(EXCEPT(VALUES('Table'[ID]),
SUMMARIZE(FILTER(ALL('Table'),
[Date]<=MIN('Table'[Date])&&[Date]>=EDATE(MIN('Table'[Date]),-12)),[ID])))
the final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-yalanwu-msft, thanks for this. Looks really good. I think I will be able to use this in my report.
Just one quick question about the measure you provided;
Does this measure return unique, distinct IDs? If not, what and where to add to the measure to return only distinct IDs?
Sorry, I am fairly new to Power BI DAX.
Thanks,
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
86 | |
82 | |
70 | |
49 |
User | Count |
---|---|
143 | |
123 | |
107 | |
61 | |
55 |