Forum Discussion

IF's avatar
IF
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

matrix for next three year data

Hi All,

I want to show in a matrix next three years' data (current, +1, +2). For example; if the slicer is selected 09.2020 then the matrix should show the data for 2020,2021 and 2022. Similarly, if 09.2019 is selected then the years should be 2019, 2020, 2021. 

I have the following example data. 

 

YearCatRegMonthValue1BP
2019Ca1R109.20205 
2019Ca2R109.20206 
2020Ca1R109.202010 
2020Ca2R109.202012 
2021Ca1R109.202014 
2022Ca1R109.202020 
2022Ca2R109.202022 
2019Ca1R209.20207 
2019Ca2R209.20208 
2020Ca1R209.202012 
2020Ca2R209.202013 
2021Ca1R209.202016 
2022Ca1R209.202024 
2022Ca2R209.202026 
##R109.2020 120
##R209.2020 300
2018Ca1R109.20199 
2018Ca2R109.201919 
2019Ca1R109.201910 
2019Ca2R109.201912 
2020Ca1R109.201914 
2024Ca1R109.201920 
2024Ca2R109.201922 
2018Ca1R209.20197 
2018Ca2R209.20198 
2019Ca1R209.201912 
2019Ca2R209.201913 
2021Ca1R209.201916 
2023Ca1R209.201924 
2023Ca2R209.201926 
##R109.2019 220
##R209.2019 400

 

Second question: is it possible to add BP value to the end of the matrix?

The file is available at:

https://www.dropbox.com/s/u190j3uvqhqdzq5/Q_Peg_next%20three%20years.pbix?dl=0

 

Thanks in advance.

  • Hi, IF 

    Sorry, I can't solve it currently.

    Just as you can’t directly add the “BP” column to the end of the matrix, it’s also difficult for you to create a row "perc" under  "total"
    Hope someone can provide a good workaroud.

     

    Best Regards,
    Community Support Team _ Eason

5 Replies

    • IF's avatar
      IF
      Icon for Post Prodigy rankPost Prodigy

      Hi,

      Thanks for the answer. However, I can use "relative" option only for date formated slicers, I believe. My field is text formated such as "09.2020", "09.2019", etc. "mm.yyyy". I have data for last 40 months. Therefore I can not use filter either.

      I hope there is a solution for this. 

      Regards,

  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity Support

    Hi, IF 

    Since your "year" column is of text type, it is recommended to create a date type "year" column first:

     

    Year(Date) = IF(ISERROR(DATE('Table'[Year],1,1)),BLANK(),DATE('Table'[Year],1,1))

     

    Then  please try measure as below t0 replace the original field "Value1":

     

    value2 = 
    VAR _sel =
        SELECTEDVALUE ( 'Table'[Month] )
    VAR _year =
        VALUE ( RIGHT ( _sel, 4 ) )
    VAR b =
        CALCULATE (
            SUM ( 'Table'[Value1] ),
            FILTER (
                'Table',
                YEAR ( 'Table'[Year(Date)] ) <= _year + 2
                    && YEAR ( 'Table'[Year(Date)] ) >= _year
            )
        )
    RETURN
        IF ( ISFILTERED ( 'Table'[Month] ), b, SUM ( 'Table'[Value1] ) )

     

    Then result will show as below:

    Please check attached pbix file for more details.

     

    For you Second question, I'm afraid that it‘s  impossible to add BP value to the end of the matrix.You need to create another table visual to  show it.

     

    Best Regards,
    Community Support Team _ Eason

     

    • IF's avatar
      IF
      Icon for Post Prodigy rankPost Prodigy

      Hi,

      Thanks. The file works well. Is it possible to show both percentage and total at the same time?

      Regards,

  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity Support

    Hi, IF 

    Sorry, I can't solve it currently.

    Just as you can’t directly add the “BP” column to the end of the matrix, it’s also difficult for you to create a row "perc" under  "total"
    Hope someone can provide a good workaroud.

     

    Best Regards,
    Community Support Team _ Eason