cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bcharlto Frequent Visitor
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

Accepted Solutions
Highlighted
Moderator v-qiuyu-msft
Moderator

Re: Rolling Regular Price Calculations

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
Moderator v-qiuyu-msft
Moderator

Re: Rolling Regular Price Calculations

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

Re: Rolling Regular Price Calculations

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...

 

Highlighted
Moderator v-qiuyu-msft
Moderator

Re: Rolling Regular Price Calculations

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

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 89 members 1,507 guests
Please welcome our newest community members: