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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
moizsherwani
Continued Contributor
Continued Contributor

Compare unrelated table

The question is about the tables with the relationship as in the image 

 

https://drive.google.com/file/d/0B0WBkUc3tofdTVJVeFdGQll1MzQ/view?usp=sharing

 

I want to create a measure which calculates the sum of a value in "Sales Order - Forecasting" Table only for values where the Month of the "OrderDate" is equal to the month of "Last Date" from the custom_opportunityforecastperiod. I am unable to get this to work since the two tables are not related directly. Please help!

AmountOfForecastOppConfirmed2 = CALCULATE(
                                                             SUM('SalesOrder - For Forecasting'[SalesOrderTotalSalesPointsB]),
                                                             MONTH(OrderDate) = MONTH(custom_opportunityforecastperiod[LastDate])
)

 

Please note due to certain reasons I cannot add a new Date Table and link the two, I need a DAX formula to work with these

Thanks,

Moiz
Was I able to answer your question? Mark my post as a solution to help others. Kudos if you liked the solution.
3 REPLIES 3
moizsherwani
Continued Contributor
Continued Contributor

I figured this out using a Crossjoin between the tables but would also like to hear any other expert thoughts on how else it could be done. I used

 

AmountOfForecastOppConfirmed2 = CALCULATE(
                                                             SUM(Table1[VALUE]),

                                                                            FILTER(CROSSJOIN(TABLE1, TABLE2),
                                                                                 MONTH(TABLE1[DATE]) = MONTH(TABLE2[DATE])
)

Thanks,

Moiz
Was I able to answer your question? Mark my post as a solution to help others. Kudos if you liked the solution.

Hi @moizsherwani , there is nothing wrong with the cross join.  You can speed it up if the tables are large by using variables and filtering each of the tables before the cross join.  But don't worry about that until you need to.

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @moizsherwani,

After resaerch, using Crossjoin is good. I will post the update if I find new solution.

Best Regards,
Angelia

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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