Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Putting 2 groups of data (from the same column source) on the same chart

 

 

Hello,

I am quite new to PowerBI, so any help with this would be greatly appreciated!

I'm trying to display 2 snippets/subsets of data within the same chart, using 2 separate date slicers to select each date's corresponding data (see highlighted slicers.) Ideally, the chart I create should look like the third screenshot attached, except the colors would designate the 2 different dates I choose from the slicers

The data itself is a distribution of sales records that fall into different bins (across the bottom) and each bar's height is a COUNT of those records.

I've created a copy/separate Date table with a 1-to-1 join relationship with the original Date table, in hopes that changing one wouldn't change the other. Unfortunately, the slicers are still somehow correlated and the only option on the second slicer after selecting a date on the first slicer is the selected date. Alfternatively, if it is easier to correlate each slicer with its own chart (second image attached), that type of view could work as well.    

 

 

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    There's a relationship between two date tables, not doubt the changing one will affect the other.

    You could try to delete or inactive the relationship and create a measure like below then add it to visual.

    Measure = CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[date]=SELECTEDVALUE('date2'[date])&&'Table'[type]=SELECTEDVALUE('Table'[type])))

     

     

    Best Regards,

    Jay

2 Replies

  • Hi Anonymous ,

     

    To what I can understand you want to have selection of two date slicers and the calculate the count of the values accordingly to those selections.

     

    What you need to do is to create two additional date table that will allow you to have the slicer values this table should be disconnected from your original table then you need to create measures similar to this ones:

     

    Calculation1 =
    CALCULATE (
        COUNT ( Table[Column] ),
        FILTER ( ALLSELECTED ( Table[Date] ), Table[Date] IN VALUES ( SLICER_1_TABLE[Date] ) )
    )
    
    Calculation2 =
    CALCULATE (
        COUNT ( Table[Column] ),
        FILTER ( ALLSELECTED ( Table[Date] ), Table[Date] IN VALUES ( SLICER_2_TABLE[Date] ) )
    )

     

     

    Now use this two measures on your visualization and the Data tables has your slicers

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    There's a relationship between two date tables, not doubt the changing one will affect the other.

    You could try to delete or inactive the relationship and create a measure like below then add it to visual.

    Measure = CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),'Table'[date]=SELECTEDVALUE('date2'[date])&&'Table'[type]=SELECTEDVALUE('Table'[type])))

     

     

    Best Regards,

    Jay