Forum Discussion
Dynamic Filter of Same Column
- 6 years ago
hi Anonymous
This works on my side.
and here is my sample pbix file, please try it.
Could you please share your sample pbix file, there should be something wrong in other.
Regards,
Lin
Hi Anonymous ,
Is the columns where you are filtering "Q1 2020" or "Q12020"
If you have a space in the middle you need to change the formula a little bit try this one:
Vaddlue =
VAR Year_Selected =
RIGHT ( SELECTEDVALUE ( 'Table'[Quarter] ), 4 )
VAR Quarter_Selected =
LEFT ( SELECTEDVALUE ( 'Table'[Quarter] ), 3 )
RETURN
SUM ( 'Table'[Value] )
/ CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table'[Quarter] ),
'Table'[Quarter] = Quarter_Selected & ( Year_Selected - 1 )
)
)
Using the value 3 on the LEFT formula you will pick up the "Q1 ".
Thanks for the prompt response but I have already taken care of the space. I am getting infinity value using this formula.
- MFelix6 years ago
Super User
Can you share the formula you are using please.
On the test I have made everything was working properly.
- Anonymous6 years agoNot applicableVAR Year_Selected =RIGHT ( SELECTEDVALUE ( 'PowerBI'[Qtr_FY] ), 4 )VAR Quarter_Selected =LEFT ( SELECTEDVALUE ( 'PowerBI'[Qtr_FY] ), 3 )RETURNCALCULATE (SUM ( 'PowerBI'[MRR] ),FILTER (ALL ( 'PowerBI'[Qtr_FY] ),'PowerBI'[Qtr_FY] = Quarter_Selected & ( Year_Selected-2)))
- v-lili6-msft6 years ago
Community Support
hi Anonymous
This works on my side.
and here is my sample pbix file, please try it.
Could you please share your sample pbix file, there should be something wrong in other.
Regards,
Lin
- v-lili6-msft6 years ago
Community Support
HI Anonymous
Getting infinity value means there is no value for last year for same quarter by this formula,
MFelix's formula should work, Please check if data is right, for example, filter Q12020 and Q12019 together to see if there is data in Q12019.
If you still have the problem, please share a simple sample pbix file, that will be a great help.
Regards,
Lin