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
riledup2021
New Member

Filtering Dates from another table

Hello! 

So I have been working through attempting to build logic for sales at different grains. r13w, r4w, py r13w, py r4w.  Our company has some custom logic for how we define weeks so we have a table put together that shows the week_end_date (calendardt), and each date that would fall into each aggregate for current year(rollupdt)/ Prior year(prioryeardt).

riledup2021_0-1753897277591.png

We then have daily level sales data.

 

 

I have dax written that doe work to accomplish what I attempted to below: 

R1W Sales = CALCULATE(

   SUM('Sales Metrics - Weekly'[sales]),

   TREATAS(

       CALCULATETABLE(VALUES(time_rollup[rollupdt]),time_rollup[timerollupdimcd] = "r1w"),

       'Sales Metrics - Weekly'[invoice_dt]

   ))

The current issue we are facing is with preformance, this is relatively slow.  

I was curious if anyone had a better/ more efficient way of grabbing the values from our timerollup table in order to create a similar measure.

1 ACCEPTED SOLUTION
v-dineshya
Community Support
Community Support

Hi @riledup2021 ,

Thank you for reaching out to the Microsoft Community Forum.

 

Hi @lbendlin , @FBergamaschi , Thank you for your prompt responses.

 

Hi @riledup2021 ,

Please try below two options to improve performance.

 

1. Created Calculated column "IsR1W" to "time_rollup"

 

IsR1W = IF(time_rollup[timerollupdimcd] = "r1w", TRUE(), FALSE())

 

Please change you "R1W Sales" measure with below DAX code.

 

R1W Sales = CALCULATE(
SUM('Sales Metrics - Weekly'[sales]),
FILTER(
'Sales Metrics - Weekly',
'Sales Metrics - Weekly'[invoicedt] IN
CALCULATETABLE(
VALUES(time_rollup[rollupdt]),
time_rollup[IsR1W] = TRUE()

)
)
)


2. Create a date bridge table from "time_rollup", only include rows with "r1w" and their "rollupdt". Make relationship "rollupdt" --> "invoiced" directly in the model.

 

Use the time filter from Time_R1W

 

R1W Sales = SUM('Sales Metrics - Weekly'[sales])

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

View solution in original post

6 REPLIES 6
v-dineshya
Community Support
Community Support

Hi @riledup2021 ,

Thank you for reaching out to the Microsoft Community Forum.

 

Hi @lbendlin , @FBergamaschi , Thank you for your prompt responses.

 

Hi @riledup2021 ,

Please try below two options to improve performance.

 

1. Created Calculated column "IsR1W" to "time_rollup"

 

IsR1W = IF(time_rollup[timerollupdimcd] = "r1w", TRUE(), FALSE())

 

Please change you "R1W Sales" measure with below DAX code.

 

R1W Sales = CALCULATE(
SUM('Sales Metrics - Weekly'[sales]),
FILTER(
'Sales Metrics - Weekly',
'Sales Metrics - Weekly'[invoicedt] IN
CALCULATETABLE(
VALUES(time_rollup[rollupdt]),
time_rollup[IsR1W] = TRUE()

)
)
)


2. Create a date bridge table from "time_rollup", only include rows with "r1w" and their "rollupdt". Make relationship "rollupdt" --> "invoiced" directly in the model.

 

Use the time filter from Time_R1W

 

R1W Sales = SUM('Sales Metrics - Weekly'[sales])

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

Hi @riledup2021 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @riledup2021 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @riledup2021 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

lbendlin
Super User
Super User

If you refresh your calendar table in import mode daily you can implement these ranges/grains as calculated columns.

FBergamaschi
Solution Sage
Solution Sage

Can you please add the tables in a usable format so we can replicate the measure and improve the performance?

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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