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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sabilahmed
Resolver I
Resolver I

CROSSJOIN not giving required results - too many duplicates

Hello,

 

I have created a new table via a CROSSJOIN between a Agreement Additions table and a Dim_Calendar table. See below:

 

sabilahmed_2-1661416206934.png

 

I have connected them using the StartofMonth column from Agreement Additions and Date column from Dim_Calendar (relationship model).

 

Below is the DAX for the new table 'Contracted':

 

Contracted = 
CROSSJOIN (
    'AgreementAdditions & List',
        SUMMARIZE (
            FILTER (
                'Dim_Calendar',
                'Dim_Calendar'[Date] > MIN ( 'AgreementAdditions & List'[START_DATE] )
                    && 'Dim_Calendar'[Date] < MAX ( 'AgreementAdditions & List'[END_DATE] )
            ),
            Dim_Calendar[StartofMonth]
        )
    )

 

Below are some example columns from the Agreement Additions table where the key focus is:

 

sabilahmed_3-1661416377635.png

 

As you can see the above table has a start and end date per agreement and a monthly billing amount. My goal is to repeat the number of rows per month between the start and end date. However, the resulting 'Contracted' table is not correct. See below why this is:

 

sabilahmed_4-1661417182692.png

 

The above table is what is formed from the CROSSJOIN (between Agreement Additons and Dim_Calendar). The above example agreement has a start date from Aug 2022 - Aug 2023, therefore I would expect 12 rows (1 row per month) of £9.40 for this example, but instead I get 56 rows which is strange.

 

When I plot a matrix viz, this is what I get:

sabilahmed_5-1661417409216.png

What i'm expecting to see is the below results:

sabilahmed_6-1661417488448.png

 

What am I doing wrong?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@sabilahmed , There are three approaches I have discussed do deal with date and start and end date, check if one of them can help

 

https://amitchandak.medium.com/dax-get-all-dates-between-the-start-and-end-date-8f3dac4ff90b
https://amitchandak.medium.com/power-query-get-all-dates-between-the-start-and-end-date-9ad6a84cf5f2

Measure way

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@sabilahmed , There are three approaches I have discussed do deal with date and start and end date, check if one of them can help

 

https://amitchandak.medium.com/dax-get-all-dates-between-the-start-and-end-date-8f3dac4ff90b
https://amitchandak.medium.com/power-query-get-all-dates-between-the-start-and-end-date-9ad6a84cf5f2

Measure way

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.