Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Dynamic Date Selection for X-Axis - Include Fiscal Year & QTR options

I am using this code:

Dynamic Date Selections = UNION(ADDCOLUMNS(CALENDAR(MIN('Date Table'[Date]),MAX('Date Table'[Date])),"Visual Date",DATE(YEAR([DATE]),MONTH([Date]),1),"Type","Monthly","Order",1),ADDCOLUMNS(CALENDAR(MIN('Date Table'[Date]),MAX('Date Table'[Date])),"Visual Date",DATE(YEAR([DATE]),1,1),"Type","Yearly","Order",2))
 
To create a table that looks like:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
and an X-Axis date display selction tool that looks like:
 
 
 
 
 
 
 
 
 
 
 
 
I am trying to add addtional options, such as Quarter (calendar year), Fiscal Year (July-Jun) and Fiscal QTR.  I have a date table with these options, but cannot figure out how I can add it to my options for the X-Axis dates.  Please help!
  • Anonymous , Use the column in a date table joined with the date of your table, Try to create a field parameter for the Dynamic X axis

     

    https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd

     

     

    Calendar = Addcolumns(calendar(date(2020,01,01), date(2021,12,31) ), "Month no" , month([date])
    , "Year", year([date])
    , "Month Year", format([date],"mmm-yyyy")
    , "Month year sort", year([date])*100 + month([date])
    , "Qtr Year", format([date],"yyyy-\QQ")
    , "Qtr", quarter([date])
    , "Month",FORMAT([Date],"mmmm")
    , "Month sort", month([DAte])
    , "Is Today" ,if([Date]=TODAY(),"Today",[Date]&"")
    , "Month Type", Switch( True(),
    eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
    eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
    Format([Date],"MMM-YYYY") )
    ,"Year Type" , Switch( True(),
    year([Date])= year(Today()),"This Year" ,
    year([Date])= year(Today())-1,"Last Year" ,
    Format([Date],"YYYY")
    )
    )

     

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

     

2 Replies

  • Anonymous , Use the column in a date table joined with the date of your table, Try to create a field parameter for the Dynamic X axis

     

    https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd

     

     

    Calendar = Addcolumns(calendar(date(2020,01,01), date(2021,12,31) ), "Month no" , month([date])
    , "Year", year([date])
    , "Month Year", format([date],"mmm-yyyy")
    , "Month year sort", year([date])*100 + month([date])
    , "Qtr Year", format([date],"yyyy-\QQ")
    , "Qtr", quarter([date])
    , "Month",FORMAT([Date],"mmmm")
    , "Month sort", month([DAte])
    , "Is Today" ,if([Date]=TODAY(),"Today",[Date]&"")
    , "Month Type", Switch( True(),
    eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
    eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
    Format([Date],"MMM-YYYY") )
    ,"Year Type" , Switch( True(),
    year([Date])= year(Today()),"This Year" ,
    year([Date])= year(Today())-1,"Last Year" ,
    Format([Date],"YYYY")
    )
    )

     

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I wish I had known this existed! Would have saved me so much effort, THANK YOU! Now I just have to figure out how to make my line graph not show every single date from 1990-2050 ğŸ˜…