Forum Discussion

Lucian's avatar
Lucian
Icon for Responsive Resident rankResponsive Resident
6 years ago
Solved

Variable measure name... or a workaround?

Hello,

 

I have a table similar to this one

 

 

I need a comparison table with 2 columns based on Year column, using two slicers for years.

 

So, I've created 2 tables for each slicer based on the year column using this thread: Re: Two slicer on same column

 

FilterTBL-Base = DISTINCT('DataTable'[Year])
FilterTBL-CompareTo = DISTINCT('DataTable'[Year])

And for each "filter table" the corresponding measure to know the selected value:

 

SelectedYear-Base = SELECTEDVALUE('FilterTBL-Base'[Year])

and

SelectedYear-CompareTo = SELECTEDVALUE('FilterTBL-CompareTo'[Year])

Now I could calculate the "base total" and the "total to compare to" in my data table:

 

TotalBase = SUMX(FILTER('DataTable','DataTable'[Year]=[SelectedYear-Base]),'DataTable'[Cost])

and

 

TotalCompareTo = SUMX(FILTER('DataTable','DataTable'[Year]=[SelectedYear-CompareTo]),'DataTable'[Cost])

So the entire structure looks like this:

 

 

The calculation works as expected:

 

 

The only problem it bothers me, is that the final table should have the column names based on the slicer selections. In picture above TotalBase should display "FY_2010" and the TotalCompareTo should display "FY_2011".

 

Is there a way to achieve this? I'm open to any sugestion even if requires R/Python visual.

 

Kind Regards,

Lucian

  • Lucian's avatar
    Lucian
    6 years ago

    Hi v-xuding-msft 

     

    Thank you for your time, unfortunately the two matrix will be far away from the requirement as the separate matrix will break the ideea of "comparison" as posted in my previous picture.

    If you look to your last posted picture will see that the second matrix will not "align" the values for the same project because are not available (C2 for projects A&C).

     

    The only "closest workaround" was two card visuals with same font/size as the rest of the column titles, but loosing any sort option or "focus mode" for that visual.

     

    Meanwhyle, anyone that will need "dynamic column naming" could vote for this ideea: Improved table visual - dynamic column names  

     

    Kind Regards,

    Lucian

6 Replies

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

    Hi Lucian ,

    If you want to use table visual, I'm affraid it couldn't be implemented. You could chang TABLE visual to MATRIX visual and drag the "Year" column to Columns field to be shown as column name. 

    However, there is a little flaw in this way. If you want to drag more than one value to Value field, it will show the value name and the column name at the same time. When you drag one value, it will just show column name.

    Two valuesOne value

    Best Regards,

    Xue Ding

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

    • Lucian's avatar
      Lucian
      Icon for Responsive Resident rankResponsive Resident

      Hello v-xuding-msft

       

      And thank you for your time. Indeed, matrix could be an option, unfortunately did not cover the report design requirements.

      The final report should look like this:

       

       

      Any other workaround?

       

      Kind Regards,

      Lucian

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

        Hi Lucian ,

        I'm afraid there is not a perfect method to show the two column names dynamically in the same visual.  You could try to create two matrix to show them separately as a workaround. In this way, they will be changed correctly.

        I attached my sample that you can have a try.

         

        Best Regards,

        Xue Ding

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