Forum Discussion

Ashley's avatar
Ashley
Helper II
4 years ago
Solved

Calculated Column for Bar Chart Months

Hello,

 

I currently have a bar chart in my report that I am trying to configure to update the data automatically based on the current month instead of having a slicer where the user has to select the current month. I am using a calculated column as shown below on the chart as a filter, and it works when it comes to updating the data. However, my month days do not change accordingly. For example this month for February shows 31 days, instead of 28. 

 

IsCurrentMonth = 
    IF (
        YEAR ( Inventory[dateLogged] ) = YEAR ( TODAY () )
            && MONTH ( Inventory[dateLogged] ) = MONTH ( TODAY () ),
        "Yes",
        "No"
    )

 

Does anybody know a way to make the day numbers change as well?

 

Thank you!

  • Hi Ashley 

     

    I recommend maybe adjusting the approach slightly and using Relative Dates on the axis of your chart. This will hopefully help you achieve what you are after.

    Here is a link as well to the Microsoft doc that goes into it a little bit more.  There is the choice of Slicer or Filter. Clearly, Slicer is not what you want. So scroll down the page a little and you'll get to Filters.

    https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

     

    Hope this helps! πŸ™‚

    Theo

     

5 Replies

  • TheoC's avatar
    TheoC
    Community Champion

    Hi Ashley 

     

    I recommend maybe adjusting the approach slightly and using Relative Dates on the axis of your chart. This will hopefully help you achieve what you are after.

    Here is a link as well to the Microsoft doc that goes into it a little bit more.  There is the choice of Slicer or Filter. Clearly, Slicer is not what you want. So scroll down the page a little and you'll get to Filters.

    https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

     

    Hope this helps! πŸ™‚

    Theo

     

    • Ashley's avatar
      Ashley
      Helper II

      TheoC  Thank you for your response! This unfortunately works the same way as my calculated column did, updates the data in the chart but still shows 31 days for February. 😞  Am I missing something here?