Forum Discussion

appsac1's avatar
appsac1
Icon for Helper I rankHelper I
3 years ago
Solved

Static Row Headers with calculated row values

Hello, newer user ro power bi desktop coming from Qlik Sense.  In Qlik I was able to create a table with what I call static row headers and a row of calcualted fields.  Here is what I am trying to accomplish, this is just a made up sample visual table.

 

                                    Current Year     Prior Year     Year Over Year Change

Returns                                50                 40                              10

Sales                                   125               105                             20 

Shipped                                45                 30                              15                   

 

The first column Returns, Sales, and Shipped are static values that just describe the row of data.  The other 3 columns are calculated values. Any help would greatly be appreciated.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi appsac1 ,

     

    I need to know where your data in three columns come from, a data table or you just want to create a calculated table?

    If you want to create a calculated table in Power BI, you can try this code.

    Table = 
    DATATABLE(
        "static row headers",STRING,
        "Current Year",INTEGER,
        "Piror Year",INTEGER,
        "Year Over Year Change",INTEGER,
       {{"Returns","50","40","10"},
        {"Sales","125","105","20"},
        {"Shipped","45","30","15"}
       }
    )

    Result is as below.

    If you want to calcualte based on data in fact table, please share a sample file with me.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi appsac1 ,

     

    I need to know where your data in three columns come from, a data table or you just want to create a calculated table?

    If you want to create a calculated table in Power BI, you can try this code.

    Table = 
    DATATABLE(
        "static row headers",STRING,
        "Current Year",INTEGER,
        "Piror Year",INTEGER,
        "Year Over Year Change",INTEGER,
       {{"Returns","50","40","10"},
        {"Sales","125","105","20"},
        {"Shipped","45","30","15"}
       }
    )

    Result is as below.

    If you want to calcualte based on data in fact table, please share a sample file with me.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.