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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
julsr
Resolver III
Resolver III

Power BI DAX: Calendar Table Integration Breaking Existing Measure Logic

Hi PowerBI Community,

I have an interesting DAX challenge involving the integration of a new Calendar table into an existing model. Here's my scenario:

I have three tables:

  1. A fact table (TABLE1) with transaction dates and client IDs
  2. A budget table (TABLE2) with monthly amounts, linked to TABLE1 through a YearMonth concatenated field (format: YYYYMM)
  3. A newly added Calendar table linked to TABLE1 through date relationships

Previously, I had a measure that calculated remaining budget amounts for the year based on a date slicer connected directly to TABLE1's date field. The measure worked perfectly. However, after introducing the Calendar table as my master date table (with the slicer now connected to Calendar), the measure returns blank values.

Here's my original working measure (masked for privacy):

 

Measure_Name = 
VAR CurrentDate = MAX(TABLE1[DATE_FIELD])
VAR YearStartDate = DATE(YEAR(CurrentDate), 1, 1)
VAR CurrentMonth = MONTH(CurrentDate)
RETURN
CALCULATE(
SUM(TABLE2[AMOUNT_FIELD]),
FILTER(
CROSSJOIN(
ALL(TABLE1[DATE_FIELD]),
VALUES(TABLE1[CLIENT_ID])
),
MONTH(TABLE1[DATE_FIELD]) > CurrentMonth &&
YEAR(TABLE1[DATE_FIELD]) = YEAR(CurrentDate)
)
)

 

The measure calculates future month budgets based on the selected date. It worked when the slicer was connected directly to TABLE1[DATE_FIELD], but now that I'm using a Calendar table for date selection, it's not working.

My table relationships are:

  • Calendar[Date] -> TABLE1[DATE_FIELD]
  • TABLE1[YEARMONTH] -> TABLE2[YEARMONTH]

How can I modify this measure to work with the Calendar table while maintaining the same calculation logic?

Below is sample data:

Any help would be greatly appreciated!

 

1 ACCEPTED SOLUTION

Hi,

Revise the measure to

measure_column = CALCULATE(SUM(Budget[AMOUNT_FIELD]),DATESBETWEEN('Calendar'[Date],MAX('Calendar'[Date])+1,MAXX(ALL('Calendar'),'Calendar'[Date])))

Hope this helps.

Ashish_Mathur_0-1736033797432.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

I do not know what you want to calculate.  In the attached file, i have set up the tables, relationships and slicers properly.  Build your measures now.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks! Attached is the PBIX file and the measure. The expected result is a measure that once the filter from the calendar table is active returns the sum of the budget from the budget amount field where budget Date > CAlendar date. (i.e. if February is selected in the calendar slicer, the result must be the sum of the budgets from March and April, 384,000)

https://drive.google.com/file/d/1hRrtOCUvIX_uVUj96yBAE0ws2H0IjE9O/view?usp=sharing

 

Thanks

Hi,

Revise the measure to

measure_column = CALCULATE(SUM(Budget[AMOUNT_FIELD]),DATESBETWEEN('Calendar'[Date],MAX('Calendar'[Date])+1,MAXX(ALL('Calendar'),'Calendar'[Date])))

Hope this helps.

Ashish_Mathur_0-1736033797432.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks! It's working now. 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi again! I missed one thing - the relationship between the tables. I've updated the PBIX file to reproduce the same error

https://drive.google.com/file/d/1hRrtOCUvIX_uVUj96yBAE0ws2H0IjE9O/view?usp=drive_link

 

I created measure_field2 using the code you sent me and I'm using the Power BI functionalities I need (Single Date picker and Top n 1 ordered by date), but the code you provided isn't returning the expected results. The relationship must remain as it is currently configured, which is why I cannot implement it differently. I've tried modifying it, but doing so breaks my report.

Could you provide additional guidance considering this table relationship structure?

If you insist on that relationship staying intact then i will not be able to help you because tht relationship should not exist in the first place.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors