Forum Discussion
In a column, calculate a value per group
- 3 years ago
Hi , cris1196
According to your description, you want to move the rankx column logic to the [Select Sttore] column.
Here are the steps you can refer to :
(1)This is my test data:(2)We can click "New Column" and enter this:
Select Sttore_1 = var user =[User] var _t =ADDCOLUMNS('Table',"rankx" , RANKX(FILTER('Table', 'Table'[User]=user ), 'Table'[Date],, ASC, Dense)) var _t2= FILTER(_t ,[User]=user && [rankx]=2) return MINX(_t2,[Store])(3)Then we can meet your need , the result is as follows:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
In this case it was purchase number two, but if I want to see where he made his fourth purchase
How are you specifying this? Via "What-If?" parameters?
Hello, thanks for answering. No, just change Table[Rank]=2 to Table[Rank]=4 or, I create another "select cohort" column with Table[Rank]=4.
- lbendlin3 years ago
Super User
that sounds rather restrictive and not really in the spirit of Power BI user interactivity. Are you sure you need Power BI for this?
- cris11963 years ago
Helper I
At least in my case, yes. I have three ranks columns and three "Select Cohort" columns (which, now that I realize it, should be called "Select Store"...), each for a particular purpose.
And from there comes the cause of my question: if there is any way to achieve, in this case, not needing the use of the "Rank" column
Currently I keep trying some things but without success 😑
- lbendlin3 years ago
Super User
and three "Select Cohort" columnsI don't understand that part. Your sample data only has one (and I think that is more appropriate). I don't understand what you are trying to model, but it doesn't sound like stuff you would do in Power BI.