Forum Discussion

Kishore_SR's avatar
Kishore_SR
Frequent Visitor
3 years ago

Year Combinations YOY

Hello,

 

I have an Year column with 5 different Years as of now... 2017,2018,2019,2020,2021...

 

So now I need to create all possible Year combinations like 2017 vs 2018, 2017 vs 2019 and so on

Is it possible to create calculated column or measure or any other way

 

Any help would be appreciated... Thank you in Advance!!

3 Replies

  • Hi,

    I tried to create a sample pbix file like below, and please check the below picture and the attached pbix file.

    It is for creating a new table by using whatever years the data has in the year column.

    I hope this sample can provide some ideas on how to create a solution for your dataset.

     

     

    New Table =
    ADDCOLUMNS (
        GENERATE (
            ALL ( Sales[Year] ),
            FILTER (
                SUMMARIZE ( SELECTCOLUMNS ( Sales, "@Year", Sales[Year] ), [@Year] ),
                [@Year] > VAR _currentyear = Sales[Year] RETURN _currentyear
            )
        ),
        "@Newcolumn",
            Sales[Year] & " vs " & [@Year]
    )
    
    • Kishore_SR's avatar
      Kishore_SR
      Frequent Visitor

      Hi Jihwan_Kim ,

       

      Thank you for taking your time and help me out,

       

      You have created a seperate table for Year Combo, Can we not create a table and create it inside existing table with Year Column!??

       

      If you have any idea on how to do that, please share ...

       

      Thank you👍

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Icon for Super User rankSuper User

        Hi,

        Thank you for your feedback.

        Please share your sample pbix file's link (onedrive, googledrive, dropbox, or any other) here, and then I can try to look into it to come up with a more accurate solution that suits your datamodel.

        Thank you.