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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
danyeungw
Helper II
Helper II

How have the calculated table refresh when the direct query table re-queried

I created a calcuated table in Power BI named Combined (see code below). The "Actaul Direct" table is DirectQuery mode, but each time "Actaul Direct" was refreshed and "Combined" didn't. I think it maybe because "Combined" has Import mode. 

 

How can I have "Combined" refreshed with the new data each time "Actual Direct" is refreshed? Thanks.

______________________________

Combined = UNION(
SELECTCOLUMNS('Actuals Direct',"Month",'Actuals Direct'[Mth],"Product",'Actuals Direct'[Product],'Amount'[Amount]),

SELECTCOLUMNS(CALCULATETABLE('Forecast',"Month",'Forecast'[Month],"Product",'Forecast'[Product],'Amount'[Amount])
)

8 REPLIES 8
ToddChitt
Solution Sage
Solution Sage

I highly suggest you have an independent Date dimension that joins to each of the three fact tables (Actual, Plan, and Forecast). Actuals are at a daily level, correct? That should not be an issue. But the others are what? Monthly? Then you need to decide if that value is realized on the FIRST day of the month, or the LAST. FIRST is easiest as you can create a date column in that fact table base on the month, year, and literal value of "1" (in the correct order, of course). Now join that column to the Date dimension. 

That should do it. You should now be able to slice and dice by Year and Month for all three facts.

Thanks.

danyeungw
Helper II
Helper II

Hi @ToddChitt, It is a very good question. The user's request was to go back 90 days. For example, what was the numbers as of 8/3/2023 or any date. Not as of today or now. Do you have any suggestions? Thanks.

Sorry, I guess I'm not understanding the requirement. Users want to see what the data looked like as of a certain date? Why not just bring in (IMPORT mode) all the data and then slice or filter it on the report for the date desired?

What am I missing?

The key is Product+Year+Month. "Actaul Direct" can have past 90 days. For example, Producta202308 for last 14 days. That means there are 14 multiple keys in "Actaul Direct" .The key in the "Forecast" is only one Producta202308. It became one to many join instead of one to one.

 

IF the direct qeruy brings in one day, the join is one to one. 

OK, so now that I understand your data, and forgetting the whole DIRECT QUERY vs IMPORT thing, what is the problem you are trying to solve? Why would you want to combing ACTUAL with FORECAST? Those are two different FACTS with two different granularities.

Do you want to compare ACTUAL vs FORECAST? If so, put a Date table between them. 

Yes, actaully actuals, forecast, and plan. Sorry I left out plan. I thought if I resolve "Forecast", I can resolve "Plan". "Plan" has the same key as "Forecast".

ToddChitt
Solution Sage
Solution Sage

I have been uing Power BI since before it went General Availablility and build hundreds of models. So far, I have only seen ONE real case that required DIRECT QUERY. Yet I see all kinds of threads from people asking how they can make Direct Query work.

Please take a step back and ask yourself, or your business users: "What is the business requirement for having Direct Query (in other words, REAL TIME) data?" And: "Can you live with, say, hourly refresh throughout the day?"

If they absolutely insist on DQ, then do that, but also spin up a Usage Metrics report in the Workspace where the model is deployed and watch it over the next few days, weeks, months. After three months you will probably find that usage has tailed off and people are looking at it once a day. 

I know that's not an answer to your question, but I really think it needs to be mentioned.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.