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
bcharlto
Frequent Visitor

Rolling Regular Price Calculations

I am hitting RAM limitations when running a calculated DAX column on 92 million rows. The calculation works on smaller amounts of data. Any ideas on how to convert this to SQL? I can calculate when loading the data from SQL instead.

 

Reg Price Column = CALCULATE (MAX ( 'CBG POS_Detail_TEMP'[Avg Price Column] ),FILTER ('CBG POS_Detail_TEMP','CBG POS_Detail_TEMP'[PRODUCT_NBR_RETAILER] = EARLIER ( 'CBG POS_Detail_TEMP'[PRODUCT_NBR_RETAILER] ) && 'CBG POS_Detail_TEMP'[STORE_NUMBER] = EARLIER ( 'CBG POS_Detail_TEMP'[STORE_NUMBER] )), DATESINPERIOD ( 'CBG POS_Detail_TEMP'[WEEK_END_DATE], LASTDATE ( 'CBG POS_Detail_TEMP'[WEEK_END_DATE] ), -84, DAY ))

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @bcharlto,

 

You can modify the T-SQL query like that to return "Reg Price Column":

 

select *
, 
(select max([Avg Price Column]) from  CBG_POS_Detail_TEMP b 
where  b.PRODUCT_NBR_PETAILER=a.PRODUCT_NBR_PETAILER and b.STORE_NUMBER=a.STORE_NUMBER and b.WEEK_END_DATE>=DATEADD(DAY,-84,a.WEEK_END_DATE) and b.WEEK_END_DATE<=a.WEEK_END_DATE) c
from CBG_POS_Detail_TEMP a

 

 

q5.PNGq6.PNG

 

Best Regards,

Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

Hi @bcharlto,

 

You can modify the T-SQL query like that to return "Reg Price Column":

 

select *
, 
(select max([Avg Price Column]) from  CBG_POS_Detail_TEMP b 
where  b.PRODUCT_NBR_PETAILER=a.PRODUCT_NBR_PETAILER and b.STORE_NUMBER=a.STORE_NUMBER and b.WEEK_END_DATE>=DATEADD(DAY,-84,a.WEEK_END_DATE) and b.WEEK_END_DATE<=a.WEEK_END_DATE) c
from CBG_POS_Detail_TEMP a

 

 

q5.PNGq6.PNG

 

Best Regards,

Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-qiuyu-msft
Community Support
Community Support

Hi @bcharlto,

 

The DAX you mentioned need to be evaluate in its context. It would be better if you could share some sample data and expected results for our analysis.

 

Besides, instead of connect to SQL Server in Import mode, please try to connect to it in DirectQuery mode and convert the calculated column DAX to a measure.

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-qiuyu-msft,

 

This is the same as this issue, but with more data (92 million rows vs. 14 million rows. You could use that example and print screen if you like:

http://community.powerbi.com/t5/Desktop/Turning-table-visual-into-data-table-that-I-can-join-to/m-p/...

 

 

I still have more to test with this report before trying DirectQuery, however I'm not certain that with the limitations and considerations with DirectQuery, I do not think it will work better as an overall solution in this case: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-use-directquery/#benefits-of-using...

 

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.