Forum Discussion
Filter based on a value from a previous row
Hi, i have a scenario like:
| Recipe_Name | N_Cicle |
| Test1 | 2 |
| Test1 | 2 |
| Test1 | 1 |
| Test1 | 0 |
| Test2 | 3 |
| Test2 | 3 |
| Test2 | 2 |
| Test2 | 1 |
| Test2 | 0 |
And i want to filter N_Cicle column to obtain:
| Recipe_Name | N_Cicle |
| Test1 | 2 |
| Test1 | 1 |
| Test1 | 0 |
| Test2 | 3 |
| Test2 | 2 |
| Test2 | 1 |
| Test2 | 0 |
Witch dax formula can i use?
Thanks so much
Hi Carlend ,
Can this meet your requirements?
Measure = VAR Count_ = CALCULATE ( COUNT ( 'Table'[N_Cicle] ), ALLEXCEPT ( 'Table', 'Table'[Recipe_Name], 'Table'[N_Cicle] ) ) VAR FirstIndex_ = IF ( Count_ > 1, CALCULATE ( MIN ( 'Table'[Index] ), ALLEXCEPT ( 'Table', 'Table'[Recipe_Name], 'Table'[N_Cicle] ) ), MIN ( 'Table'[Index] ) ) RETURN IF ( MIN ( 'Table'[Index] ) = FirstIndex_, 1 )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
10 Replies
- Tanushree_KapseImpactful Individual
Hi Carlend ,
Do the following changes for the column N_Cicle
Mark this as a solution, if I answered your question. Thanks
- CarlendFrequent Visitor
Hi, thanks for the help but this solution doesn't work because there is actually a third column with "different" values. I need to take only one of the rows creating a calculated column that allows me to say for example: if the value of N_Cicle is equal to the previous value of N_Cicle, return me one of the two. or something like that
- CarlendFrequent Visitor
Hi, thanks for the help but this solution doesn't work because there is actually a third column with "different" values. I need to take only one of the rows creating a calculated column that allows me to say for example: if the value of N_Cicle is equal to the previous value of N_Cicle, return me one of the two. or something like that
- VahidDMSuper User
- IceyCommunity Support
Hi Carlend ,
Can this meet your requirements?
Measure = VAR Count_ = CALCULATE ( COUNT ( 'Table'[N_Cicle] ), ALLEXCEPT ( 'Table', 'Table'[Recipe_Name], 'Table'[N_Cicle] ) ) VAR FirstIndex_ = IF ( Count_ > 1, CALCULATE ( MIN ( 'Table'[Index] ), ALLEXCEPT ( 'Table', 'Table'[Recipe_Name], 'Table'[N_Cicle] ) ), MIN ( 'Table'[Index] ) ) RETURN IF ( MIN ( 'Table'[Index] ) = FirstIndex_, 1 )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.