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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

SSRS SQL Query to DAX Query

Hi All, I am migrating a report from SSRS to Power BI. For the SSRS report source is SQL Server, whereas for Power Bi source is SSAS Tabular model. I am not able to find the exact DAX query for the below SSRS SQL Query. Please find the below 2 Sql statements in the query. Below SQL Query start date and end date are parameters in SSRS. 1)------------------------------------------------Where list---------------------------------------- WHERE (CAST(RecordDate AS date) > DATEADD(day, -7, @StartDate)) AND (CAST(RecordDate AS date) <= DATEADD(day, 0, @EndDate)) 2)-------------------------------------------------Select list---------------------------------------- SUM (GasProduction/7) OVER (ORDER BY RecordDate ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS Avg7DayGas Thanks in advance.
3 REPLIES 3
Anonymous
Not applicable

Hi All, I need urgent help in Dax Formula for the below requirement. I am migrating a SSRS report to Power BI. Below is the SQL Query applied in SSRS report, that i need to replicate in DAX Query. SUM (FlowRate/7) OVER (ORDER BY RecordDate ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS Avg7Gas Input: Division Area Field WellName RecordDate FlowRate NORTH WOOD HOSS 1/2/2019 449.4054608 NORTH WOOD HOSS 1/1/2019 449.3890785 NORTH WOOD HOSS 12/31/2018 449.378157 NORTH WOOD HOSS 12/30/2018 461.4709898 NORTH WOOD HOSS 12/29/2018 463.4600683 NORTH WOOD HOSS 12/28/2018 473.487372 NORTH WOOD HOSS 12/27/2018 466.3945392 Result 458.9979522 Avg7Gas=SUM(449+449+449+461+463+473+463+466)/7 Output: NORTH WOOD HOSS 1/2/2019 458.9979522 Thanks in advance.
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may view the code generated by Quick measure Rolling average.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for the reply. I tried it is not helping out. Can you please provide the relevant dax query for the below sql code. SUM (GasProduction/7) OVER (ORDER BY Date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS Avg7DayGas I want to show single record as total average current + preceding 6 rows also, Where i am getting only first record average as 449/7=64. Avg7DayGas=SUM(449+449+449+461+463+473+463+466)/7=459

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.