Forum Discussion
How to Hide Last 4 Quarters data in X axis Dynamically
Hi
I have an X axis with continous quarterly data from 2017 till data. i want to hide last 4 quarters and show upto 2018-Q4.
if next april comes i.e 2020 -Q1 , i have to get 2019-Q1 automatically.
Eg: Xaxis :
2017-Q1,2017-Q2,2017-Q3,2017-Q4, 2018-Q1,2018-Q2,2018-Q3,2018-Q4, 2020-Q1 ( Here 2019 quarter data is on hide) now.
like wise in april 2020 -Q1 comes automatically i have to show 2019-Q1 data
- Anonymous6 years ago
HI rajendraongole1 ,
You can try to use the following measure to check current category and return tag, then you can use it on the line chart visual level filter to only display 'Y' tag records:
Measure = VAR _last = MAXX ( ALLSELECTED ( Test[YearQuarter] ), [YearQuarter] ) VAR _curr = LEFT ( MAX ( Test[YearQuarter] ), 4 ) & RIGHT ( MAX ( Test[YearQuarter] ), 1 ) VAR prev = LEFT ( _last, 4 ) - 1 & RIGHT ( _last, 1 ) RETURN IF ( _curr < prev, "Y", "N" )Regards,
Xiaoxin Sheng
10 Replies
- AnonymousNot applicable
Hi rajendraongole1 ,
Can you share the pbix / data on Google / One Drive and paste the linke here. Please also share what is the solution you expect.
Cheers
CheenuSing
- rajendraongole1Super User
Thanks for your reply.
I will two visuals :
Visual-1, as of now i have all Quarters data information till date.
Requirement is in Visual-2
though i have 2019 all Quarter data, I want to showcase data upto 2018-4 Quarter only untill 2020-01 the data of 2019.01 should comes automatically without using manual filter condition.
- rajendraongole1Super User
- AnonymousNot applicable
Hi rajendraongole1,
Maybe you can add a measure to extract and compare current date and return tag, then use it as a filter on visual level to filter the last 4 quarters.
Applying a measure filter in Power BI
If you are confused coding formula, please share some dummy data to test.
Regards,Xiaoxin Sheng
- rajendraongole1Super User
Hi Anonymous Xiaoxin Sheng,
YearQuarter Value 2015-1 3384 2015-2 3334 2015-3 2000 2015-4 3218 2016-1 3392 2016-2 4327 2016-3 4141 2016-4 2611 2017-1 2530 2017-2 6835 2017-3 5888 2017-4 2351 2018-1 3567 2018-2 4499 2018-3 3742 2018-4 2253 2019-1 1232 2019-2 8654 2019-3 3455 2019-4 2233 Thanks for the reply, I have shared the attached Excel. with current Output & Expecting output.
I have data available for last year Quarter data, but i ha ve to hide last complete year data and have to show upto before completed Quarter information. once this current Quarter next month data comes then only i have show 2019-Q1 .
I hope this information is helpful to understand.
Thanks
Expected:
Next Quarter i.e., 2020-01 comes then only i have to report 2019-1 Quarter data (values should reflect automatically).
Thank you.
- AnonymousNot applicable
HI rajendraongole1 ,
You can try to use the following measure to check current category and return tag, then you can use it on the line chart visual level filter to only display 'Y' tag records:
Measure = VAR _last = MAXX ( ALLSELECTED ( Test[YearQuarter] ), [YearQuarter] ) VAR _curr = LEFT ( MAX ( Test[YearQuarter] ), 4 ) & RIGHT ( MAX ( Test[YearQuarter] ), 1 ) VAR prev = LEFT ( _last, 4 ) - 1 & RIGHT ( _last, 1 ) RETURN IF ( _curr < prev, "Y", "N" )Regards,
Xiaoxin Sheng