Forum Discussion

rajendraongole1's avatar
rajendraongole1
Super User
6 years ago
Solved

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

 

  • Anonymous's avatar
    Anonymous
    6 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

  • Anonymous's avatar
    Anonymous
    Not 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

    • rajendraongole1's avatar
      rajendraongole1
      Super 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.

       

       

       

  • Anonymous's avatar
    Anonymous
    Not 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

    • rajendraongole1's avatar
      rajendraongole1
      Super User

      Hi Anonymous Xiaoxin Sheng,

       

      YearQuarterValue
      2015-13384
      2015-23334
      2015-32000
      2015-43218
      2016-13392
      2016-24327
      2016-34141
      2016-42611
      2017-12530
      2017-26835
      2017-35888
      2017-42351
      2018-13567
      2018-24499
      2018-33742
      2018-42253
      2019-11232
      2019-28654
      2019-33455
      2019-42233

       

       

      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.

       

       

      • Anonymous's avatar
        Anonymous
        Not 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