The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello!
In my previous post I asked how to prepare dataset for resource load.
For example, for every row of db_task table
I need to recieve this in another table:
The solution was to add a table on DAX:
clx_ResourcePlans =
SUMMARIZE(
filter(
CROSSJOIN(db_assignment, Local_DateTime),
Local_DateTime[Date]>=db_assignment[planned_start]
&& Local_DateTime[Date]<=db_assignment[planned_finish]
&& NOT(Local_DateTime[IsHolidayInRussia])
),
db_assignment[task_id], db_assignment[user_id], Local_DateTime[Date], "_plan", round(sum(db_assignment[DailyHours]), 2), "_fact", 0
)
Then, I made another table for facts:
clx_ResourceFacts =
SUMMARIZE(
FILTER(
CROSSJOIN(db_task, db_time_entry),
db_task[id]==db_time_entry[task_id]
&& db_time_entry[is_billable]="t")
,
db_time_entry[task_id], db_time_entry[user_id], db_time_entry[for_date], "_plan", 0, "_fact", round(sum(db_time_entry[hours]), 2)
)
In order to compare plans an facts, I append two tables:
clx_ResourceLoad = UNION(clx_ResourcePlans, clx_ResourceFacts)
Now the problem is that UNION expects, that I need two tables with the same structure. The same structure means the same number of columns. The matching is based on the position of the column in the table.
As you can see, I even add "_plan" column to clx_ResourceFacts table and "_fact" - to clx_ResourcePlans table.
But it did not help. My tables have different sequence of columns. An I get something like this
How can I solve this?
I read, that it is strongly recommended to have a look at Append and Merge transformations in Power Query instead of combining tables in DAX.
But I don't know how to merge tables in DAX using advanced condition, like
Local_DateTime[Date]>=db_assignment[planned_start]
&& Local_DateTime[Date]<=db_assignment[planned_finish]
Solved! Go to Solution.
@Anonymous If I am following this, use SELECTCOLUMNS to get your two tables to have the same order and names of columns prior to UNION.
@Anonymous If I am following this, use SELECTCOLUMNS to get your two tables to have the same order and names of columns prior to UNION.