The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
I have a table like this:
Date | Customer | Amount |
15-Mar | C | 200 |
1-Apr | A | 100 |
26-May | B | 200 |
18-Jun | C | 300 |
13-Jun | A | 100 |
My problemn is, for each Customer, i need to know which month he bought item and also 2 or 3 months ago, he didn't buy it. If there are 2 or months satisfying same this condition, take the month closest to today.
Sorry for my bad english. I tried but its very complex. Thanks for any help.
Hi @duongan1602
Currently there is no year in your sample data. To compare dates with today, you need to have Year/Month/Day for date values.
In addition, how to understand the condition "also 2 or 3 months ago, he didn't buy it"? In the current sample data, customer A and C bought the item twice. Which month should be returned for them? You can provide some examples with dummy data to explain the output result. This can help us understand it better.
Best Regards,
Community Support Team _ Jing
Hi,
Share some more data and show the expected result.
@duongan1602 I created a sample file with your data and a possible way to solve this: Filter date_month satisfy complex condition 2022-07-10.pbix
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
125 | |
106 | |
84 | |
64 | |
59 |
User | Count |
---|---|
257 | |
121 | |
116 | |
100 | |
79 |