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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
hamburgernic
New Member

using a measure as a y axis

Hi,

 

I am looking to use a measure (number of months) as a y axis but am unable to do so

 

context example:

I have a few book loan records that are already due to be returned. I want to track on a monthly basis, how many months it has been overdue and display it in a bar chart where number of months it is overdue is the Y axis and number of book loan IDs is the x axis. The number of months it is overdue will change over time depending on the value of today()

 

Using the example table below

Book Loan ID, due date

Book Loan A, 01 Jan 25

Book Loan B, 01 Feb 25

Book Loan C, 01 Mar 25

Book loan D, 01 Jan 25

 

The graph should look something like this and the y axis shld change according to the number of months the loans has been overdueimage.jpg

How should i go about doing this?

3 REPLIES 3
v-karpurapud
Community Support
Community Support

Hi @hamburgernic 

Could you please confirm if your query have been resolved the solution provided by @danextian and @DataNinja777 ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

Thank you

danextian
Super User
Super User

hI @hamburgernic 

If you're going to compare the due date with the current date, a simple DATEDIFF calculated column against today's date should be enough

Months Due = 
DATEDIFF ( 'Table'[Due Date], TODAY(), MONTH )

danextian_0-1746883259042.pngHowever, if you want to determine how many months a book loan is due based on a date selected in a slicer — and expect the numbers in the visual to change accordingly — this approach will not work. Calculated columns are not responsive to slicer selections and will not adjust their values dynamically. That said, based on your description, the calculated column provided above should still meet your needs.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
DataNinja777
Super User
Super User

Hi @hamburgernic ,

 

If you're seeing just the number of days overdue and not a count of how many loans fall into each overdue bucket, that likely means you're using a measure or raw column directly in the visual, instead of grouping it properly.

First, confirm you're using this as a calculated column, not a measure:

Months Overdue = DATEDIFF('Loans'[Due Date], TODAY(), MONTH)

This column should return whole numbers like 1, 2, 3 for each loan.

Now, create a bar chart.

Drag Months Overdue to the Y-axis (this becomes your group, not a value), and then drag Book Loan ID to the X-axis using Count aggregation (or just drag Book Loan ID again and let Power BI auto-aggregate). This will show you how many book loans fall into each “months overdue” bucket.

If you want to group by months and show total value (e.g., amount per loan), then use this setup:

Make sure your table has a column like Loan Amount, then use a bar chart with:

Y-axis: Months Overdue
X-axis: a measure like:

Total Loan Amount = SUM('Loans'[Loan Amount])

This gives you total overdue loan amount by number of months overdue. If you’re still only seeing day-level data, make sure you’re not accidentally using DATEDIFF(..., DAY) instead of MONTH.

Do you want to show the loan amounts overdue by month, or the count of books overdue by month?

 

Best regards,

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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