Forum Discussion

reynaldo_malave's avatar
reynaldo_malave
Icon for Helper III rankHelper III
5 years ago
Solved

join a virtual table with an imported table

Hi Guys, 

 

Thanks all that take the time to answer questions on the community. 

 

Here is my problem I created a virtual table ( 'forecasttable') that contains a forecast for the current month. I want to create a relationship between this table and my calendar. I have tried both join functions but it doesnt find the joining columns. 

 

Here is the working code that returns the total forecasted amount.

 

VAR forecasttable=

	ADDCOLUMNS(
		uniondatesandgroups, 
		"forecast", 
			IF( [Date] <= lastdate,
				[$ Total],
				[dailyforecast]
			)
	)

var forecast =

    SUMX( forecasttable, [forecast] )

RETURN

   forecast 

 

  • What you have there is a measure which returns a scalar value. The virtual table is only relevant to the calculation and is not a physical table in the model. So you can't create relationships. 
    You need to create a new physical table using the code you have for the virtual table in a new table (under "Modeling" in the ribbon).

4 Replies