Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Default selection in the dashboard

Hi all,

 

i have a Quarter field. like bleow   2019Q1,2019Q2,2019Q3,2019Q4 ,2020Q1,2020Q2

 

So now my requirment is  whenever i open the dashboard i want to show  latest 4 qurts to be shown in table  .later on user will do slice and dice,

 

it should be dynamic .  it should always take latest four quarters only to be selected.

4 Replies

  • Hi. Please consider having a calendar table each time you want to use date in your analysis. First you need a date column (the best option is that the date column is related with the calendar table so you can on calendar table), then you can add a calculated column dax code like this:

    Last 4 quarters = 
    IF(
        DATEDIFF(Calendar[Date], today(), QUARTER) <= 4,
        "Last 4 quarters",
        "From last 4 quarter to firt date"
    )

    That way you create a column that substract dates with today by quarter. If the result es 4 or less then it's in the last 4 quarters. You can add any text or result you want like the text I'm suggesting.

    Once you have this new column just add it as a filter on the page (it can be in the filter pane or in the page). Select the "Last 4 quarters" and boom. Each time the dataset is refreshed it will filter by last 4 quarters from today.

     

    NOTE: if you don't have a date column you can replace "Q1" with "-01-01" to have something from 2019Q1 to 2019-01-01. With that new column the dax should work too.

     

    Hope this helps,

    Regards,

    • parry2k's avatar
      parry2k
      Icon for Super User rankSuper User

      Anonymous you can use relative date filtering functionality, read here.

       

      I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

      • ibarrau's avatar
        ibarrau
        Icon for Super User rankSuper User

        parry2k I don't think you can. The relative date will only let you work with days, weeks, months and year. However I haven't seen quarters in that analysis. He can try 12 months (4 quartes) because if he doesn't have dates and 2019Q1 = 2019-01-01 then you can use last 12 months but if he has dates like 2019-04-26 that row will need the dax because it won't be filtered with the relative properly.

        :S