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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.