Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everyone. I have a table like this:
| Date | || | User | || | Region | || | Country | || | First Order Europe | || | First Order Asia | || | Cohort |
| 01/01/2022 | || | Carl | || | America | || | Bolivia | || | False | || | False | || | 202201 |
| 01/02/2022 | || | Carl | || | Europe | || | Spain | || | True | || | False | || | 202202 |
| 01/03/2022 | || | Carl | || | Asia | || | China | || | False | || | True | || | 202203 |
| 05/03/2022 | || | Carl | || | Asia | || | Vietnam | || | False | || | True | || | 202203 |
| 06/03/2022 | || | Carl | || | Europe | || | Italy | || | False | || | False | || | 202203 |
So, in a matrix whose rows are the "Cohort" column and the columns are the Date column in day format, I want to see the number of users who bought twice (=2), in 30 days or less, by region, example, Region = Asia
I managed to do it by creating more columns and a measure, but my problem with the current logic is that if I then want to add a Slicer, for example by country, the results give me incorrect results (in my case, there were rows where my column was =2 but it was because the user bought twice in the region, not necessarily in the same country). So I'm looking for something more dynamic, ie putting everything in a measure, but currently I couldn't manage to do it.
I tried to do it by trying calculations whose base is:
Measure =
var min_date = MIN(Table[Date])
var max_date = min_date+30
return
CALCULATE(
COUNTROWS( 'Table' ),
ALLSELECTED( 'Table' ),
VALUES( 'Table'[User] ),
FILTER(Table, MIN(Table[Date])>=min_date && MIN(Table[Date])<=max_date)
)=2
But this kind of logic throws me the error that I don't have enough memory or the results are wrong. If anyone comes up with another way, I appreciate it!
Thanks
Please try
Measure =
VAR UserList =
CALCULATE(
DISTINCTCOUNT(Table[User]),
FILTER(
ALL(Table),
Table[Region] = SELECTEDVALUE(Table[Region]),
Table[First Order Asia] = True,
MIN(Table[Date])<Table[Date]+30
)
)
RETURN
CALCULATE(
COUNT(Table[User]),
FILTER(
Table,
Table[User] IN UserList,
Table[Region] = SELECTEDVALUE(Table[Region]),
Table[First Order Asia] = True,
MIN(Table[Date])<Table[Date]+30
)
) / 2
First, thanks for answering 🙂 . It doesn't work for me, changing the commas to "&&", I have problems with the "In" operator since it throws me an error. Even if I put the variable inside { }, I get the following error:
Edit: I forgot to comment that this is because the calculation in the variable is a distinctcount. I replace it with a "values" but I get the out of memory error 😔
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.