Forum Discussion

acanepa's avatar
acanepa
Icon for Resolver I rankResolver I
9 years ago
Solved

Filter by columns on the fly

Hello,   I want to know if is possible to filter by columns for a lineor barchart. For example let's say I have 3 measures, pageviews, visits and bounces. And I want to graph them in an line chart...
  • dkay84_PowerBI's avatar
    9 years ago

    You could take this approach.

     

    Create a table called Measures. The contents will be 

    MeasureName , MeasureID as column names

    The rows will be

    pageviews , 1

    visits , 2

    bounces, 3

     

    Create a measure in the data model as follows :

     

    Showvalue=switch (TRUE,
    Min ( Measures[MeasureID] ) = 1,
    ( [pageviews] ),                            /* replace this by your fomula for pagevies or if already exists put that measurename */
    Min ( Measures[MeasureID] ) = 2,
    ( [visits] ),                                      /* replace this by your fomula for visits or if already exists put that measurename */

    Min ( Measures[MeasureID] ) = 3,

    ( [bounces] ) )                               /* replace this by your fomula for bounces or if already exists put that measurename */

     

    Now create a slicer with Measure table column MeasureName .

     

    In the chart or table , use the measure Showvalue as your values column to chart or display in table and you will have the results.

     

    Credit for this solution goes to Anonymous