Forum Discussion
cris1196
Helper I
3 years agoIn a column, calculate a value per group
Hi All. I want to reduce the amount of columns that I currently have. My table has the following format: Date User Store Cohort Year Rank Select Store 01/01/2021 25 ...
- 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
lbendlin
Super User
3 years agoIn 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?
cris1196
Helper I
3 years agoHello, thanks for answering. No, just change Table[Rank]=2 to Table[Rank]=4 or, I create another "select cohort" column with Table[Rank]=4.