Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Change time on axis dynamically using slicer

Hi guys,

I would like help with dynamically changing time on x axis of visuals using slicer. For now i have 4 different visuals and have been using bookmarks to give the user buttons to switch between visuals, but i would like to have one visuals instead of 4 like shown in the following pictures:

 

The first 3 graphs are for shifts of the day (morning, afternoon and evening) and the fourth graph is for the whole day.

the slicer on the top is meant to be a date picker and select today-1 so yesterday.

 

 

I created a measure to use as a filter. I succeded to make it work for selecting today-1 but not the shifts. Anybody knows how to do this?

 

The output should be a visual and slicer containing 4 options (morning shift, afternoon shift, rvening shift and day)

 

I also shared my Powerbi file if anybody would like to examine it.

https://drive.google.com/file/d/1Z15hSFMcs2-dDgCwdZSVixfKW0YN9MSX/view?usp=sharing

  • Anonymous 

    As per my understanding, you need to be able to filter by Shift. You can insert a Slicer Visual and assign the Shift column, leave it unselected for the whole day. You create a measure for the dynamics Title 

     

    Shift Selected = SELECTEDVALUE(DummyTable[shifts])
     

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply ๐Ÿ™‚


    Website YouTube  LinkedIn

     

3 Replies

  • Anonymous hey sorry not clear what you are trying to achieve. can you provide details on what the final output should look like.

  • Anonymous 

    As per my understanding, you need to be able to filter by Shift. You can insert a Slicer Visual and assign the Shift column, leave it unselected for the whole day. You create a measure for the dynamics Title 

     

    Shift Selected = SELECTEDVALUE(DummyTable[shifts])
     

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply ๐Ÿ™‚


    Website YouTube  LinkedIn

     

  • Anonymous , Based on what I got.

    You can create new 4 measures like and use measure filter

     

    morningShift = CALCULATE(sum(DummyTable[Tonnage to terrain]), FILTER(DummyTable,CONTAINSSTRING([currentDay],"day") && DummyTable[shifts] = "morningShift" ))
    
    afternoonShift = CALCULATE(sum(DummyTable[Tonnage to terrain]), FILTER(DummyTable,CONTAINSSTRING([currentDay],"day") && DummyTable[shifts] = "afternoonShift " ))
    
    eveningShift = CALCULATE(sum(DummyTable[Tonnage to terrain]), FILTER(DummyTable,CONTAINSSTRING([currentDay],"day") && DummyTable[shifts] = "eveningShift" ))
    
    Day = CALCULATE(sum(DummyTable[Tonnage to terrain]), FILTER(DummyTable,CONTAINSSTRING([currentDay],"day"))

     

     

    measure slicer
    https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern
    https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115