MG81
MG81

Reputation: 1

Power BI Dax Function Count / Countrows

I need help with a query. I need to identify if clients who have made a purchase this month, have made a previous purchase within the last 6 months. I've been trying to use COUNTA and COUNTROWS but I cannot get it to work. Not sure what the best approach to this would be.

All the data is on one table Purchase History. I've made a dummy table on Excel (example below):

enter image description here

I want to create a new column with a simple Yes/No to identify if a client has made a purchase within 6 months.

Any help will be greatly appreciated. I've spent far to long on this and spent even longer looking through the web. Got completely lost! :(

Upvotes: 0

Views: 563

Answers (1)

Alexis Olson
Alexis Olson

Reputation: 40244

I'd recommend using the DATEDIFF function.

6 Month Check = IF(DATEDIFF('Purchase History'[Purchase Date], TODAY(), MONTH) < 6,
                    "Under 6 Months",
                    "Over 6 Months")

Upvotes: 0

Related Questions