Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ashley
Helper II
Helper II

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!

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

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.

TheoC_0-1643947900860.png

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

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

5 REPLIES 5
TheoC
Super User
Super User

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.

TheoC_0-1643947900860.png

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

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@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?

Hi @Ashley how have you structured your Date table?

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@Ashley if you don't have a Date table, I recommend doing a simple one using the below link as it will provide a significant amount of "stress relieft" - Creating a simple date table in DAX - SQLBI

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC Thank you, I created a simple and clean date table and created a relationship with my Inventory table. Now the relative date time filter works properly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.