Forum Discussion

krjen's avatar
krjen
Regular Visitor
1 year ago
Solved

Period slicer using calculated columns

I am pretty new at Power BI, but I can't wrap my head around this problem: 

In my date table I have these 4 columns: 

These columns returns true/false values if the date is in "the last 12 months" or "last 16 weeks", etc.  

The problem is this: 
I want to create a slicer with "Year", "Quarter", "Week" and "Month" that shows the given period in my visuals. 

Any idea on what I should do next? 
When I choose "year", it should return the last 3 years. 

  • You can use the built-in slicer for creating dynamic date ranges like "last # day" or "last # month" etc.

    Follow these steps: make a slicer > Slicer settings > style: Relative Date

     



3 Replies

  • you can try to create a measure.

     

    = if(selectedvalue(column)="Year" && max((true/false)Last 3 years)=true(), 1)

     

    then add this measure to visual filter and set to 1.

     

     

  • You can use the built-in slicer for creating dynamic date ranges like "last # day" or "last # month" etc.

    Follow these steps: make a slicer > Slicer settings > style: Relative Date

     



  • krjen's avatar
    krjen
    Regular Visitor

    Thanks for solutions. But it is not exactly what I need. 
    It wont change the values on x axis (showing year when I filter on months). 

    I`ve created a Dynamic Date table: 

     

     

    Is there any way I can use the "Dyanamic Date" column as a slicer, and connect the "Year" row to the
    "(true/false) Last 3 Years" column in date table? 

    Example: 
    If I press "Year" It should return the last three years (they have value "True" in 'Date'[(true/false) Last 3 year]).