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

View all the Fabric Data Days sessions on demand. View schedule

Reply
tcpafc
Regular Visitor

Help with monthly change across two columns

Hi there - I am very new to PBI and am struggling with the concept of date tables and relationships. I know there must be a very simple, elegant way to achieve what I want but I just can't make the connection (literally and figuratively).

 

I have a table of data, containing account numbers, and the date those accounts were opened and closed (and not all are closed), example below. 

Basically, I need to calculate the cumulative change from month to month (i.e. starting number plus number of accounts opened minus number of accounts closed), but because I can't work out how to link two different date columns to a single calendar month, I can't work out how to get the model to recognise that e.g. an account with "Date Opened" in March 2020 and an account with "Date Closed" in March 2020 should both be recognised in "Calendar Date" of March 2020. 

 

If any of this makes any sense, please could you help me work out what I assume is a very simple solution? The more forums I look at and YouTube vids I watch, the more confused I get! Many thanks, 

TC

 

Account numberDate openedDate closed
A1231/01/20193/05/2022
A2343/04/2020 
A34520/06/20206/03/2025
A4566/09/2020 
A56723/11/202019/01/2022
A6789/02/20214/05/2023
A78928/04/2021 
A89015/07/2021 
B1231/10/20211/01/2024
B23418/12/2021 
B3456/03/2022 
B45623/05/20222/09/2025
B5679/08/2022 
B67826/10/2022 
B78912/01/2023 
B89031/03/202312/08/2024
C12317/06/2023 
C2343/09/2023 
C34520/11/20232/08/2025
C4566/02/2024 
C56724/04/2024 
C67811/07/20243/01/2025
C78927/09/2024 
C89014/12/2024 
1 ACCEPTED SOLUTION

Thanks all - as per my message below, I ended up finding a solution, but am very grateful to everyone that provided suggestions. Every one is helping me learn, so very much appreciated 🙂 

TC

View solution in original post

10 REPLIES 10
v-achippa
Community Support
Community Support

Hi @tcpafc,

 

We wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

Thanks all - as per my message below, I ended up finding a solution, but am very grateful to everyone that provided suggestions. Every one is helping me learn, so very much appreciated 🙂 

TC

Hi @tcpafc,

 

Thank you for the response and confirming that the issue is resolved now. We are closing this thread for now, if you have any other issues please raise a new thread in the community forum, we are ready to assist you on that.

 

Thanks and regards,

Anjan Kumar Chippa

Shubham_rai955
Power Participant
Power Participant

To calculate monthly change using two date columns (opened and closed) in Power BI, use a single date table and set one active and one inactive relationship, then use DAX measures with USERELATIONSHIP to calculate for each date field.​

Step-by-Step Solution

  • Create a single date table in your model and mark it as the date table.​

  • Create one active relationship between your date table and the Date Opened column.

  • Create another (inactive) relationship between the same date table and the Date Closed column.

  • For monthly opens, use a simple COUNTROWS/CALCULATE measure linked to the active relationship.

  • For monthly closes, use a DAX measure with USERELATIONSHIP to activate the Date Closed relationship, e.g.:

     
    Accounts Closed = CALCULATE( COUNTROWS(table), USERELATIONSHIP(table[Date Closed], DateTable[Date]) )
  • Calculate cumulative monthly change with:

     
    Monthly Change = [Accounts Opened] - [Accounts Closed]

    and to get cumulative by month:

     
    Cumulative Change = CALCULATE( SUMX(DateTable, [Monthly Change]), FILTER(DateTable, DateTable[Date] <= MAX(DateTable[Date])) ) )[web:34][web:31]

This lets your visuals show accounts opened/closed each month and the cumulative total, based on both date columns in one calendar contex

v-achippa
Community Support
Community Support

Hi @tcpafc,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @Poojara_D12@Ashish_Mathur@ryan_mayu and @amitchandak for the prompt response.

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

Poojara_D12
Super User
Super User

Hi @tcpafc 

This is a very common challenge for Power BI beginners, and you’re right — it comes down to how relationships and date tables work. Power BI only allows one active relationship between a fact table and a date table at a time, which is why linking both “Date Opened” and “Date Closed” directly to a single calendar doesn’t behave as expected. In your case, the simplest and most flexible approach is to use one master Date table (a continuous list of dates covering the full range of your data) and then create two relationships between it and your account table — one to Date Opened (active) and another to Date Closed (inactive). With that setup, you can build two separate measures: one for Accounts Opened using the active relationship, and another for Accounts Closed using the USERELATIONSHIP function to activate the “Date Closed” link only within that calculation.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
tcpafc
Regular Visitor

Thanks you both so much for your suggestions  - I ended up working it out a different way (or rather, I thought I did exactly the same as I previously had but it suddenly worked!) but I really appreciate the efforts. Not sure if I should mark as a solution or not, as I didn't use them? (I'm new here!) Thanks again, 

TC

Ashish_Mathur
Super User
Super User

Hi,

Based on the data that you have shared, show the expected result.


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

@tcpafc 

you can create a dim date table and create a measure

 

measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Date opened]<=max('date'[Date])))- CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Date closed]<=max('date'[Date])&&not(ISBLANK('Table'[Date closed]))))
 
11.png
 
pls see the attachment below




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

Proud to be a Super User!




amitchandak
Super User
Super User

@tcpafc , Please check if the two attached files can help . You need one active and one inactive join Closed will inactive for given code 

 


Open = CALCULATE(COUNT(Cases[CASE_NUMBER]),USERELATIONSHIP(Cases[DATE_CASE_RECEIVED],'Date'[Date]) )

Closes = CALCULATE(COUNT(Cases[CASE_NUMBER]),USERELATIONSHIP(Cases[DATE_CASE_CLOSED],'Date'[Date]),not(ISBLANK(Cases[DATE_CASE_CLOSED])))

Current = CALCULATE(COUNTx(FILTER(Cases,Cases[DATE_CASE_RECEIVED]<=max('Date'[Date]) && (ISBLANK(Cases[DATE_CASE_CLOSED]) || Cases[DATE_CASE_CLOSED]>max('Date'[Date]))),(Cases[CASE_NUMBER])))

 

 

Or Active = 
CALCULATE([Open],filter(all('Date'),'Date'[date] <=max('Date'[date]))) - CALCULATE([Closed],filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

Active last month 

Active till last month = 
CALCULATE([Open],filter(all('Date'),'Date'[date] <=maxX('Date', dateadd('Date'[date],-1, month) )))
- CALCULATE([Closed],filter(all('Date'),'Date'[date] <=maxX('Date', dateadd('Date'[date],-1, month) )))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors