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
Anonymous
Not applicable

Creating table with date column with month and year based on other columns

I want to create a fact table in which I show contracts (Contractnummer), which has a valid from (Contract vanaf) and valid to (Contract tot) date with a component (Component) within that contract, which also has a valid from (Prijs vanaf) and valid to (Prijs tot) date, and the amount (Bedrag) that corresponds to the component. This table looks like this:

Luukvg_0-1619616981579.png

In this table, I want to create a column which shows all months and years in which both the contract and the component are active. Hence, I am looking for all months and years between the latest date of Contract vanaf and Prijs vanaf and the earliest date of Contract tot en Prijs tot for each contract and component. This should then look like:

Luukvg_1-1619617599184.png

I want to have a similar table as above but then using DAX

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,not very clear. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

But I think the attached file after signature or the blog I sharing can help

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

 

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,not very clear. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

But I think the attached file after signature or the blog I sharing can help

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

 

 

Anonymous
Not applicable

The way you use CROSSJOIN in your example has helped me in solving my problem. Thanks again!

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.

Top Solution Authors