Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Solved! Go to Solution.
@Anonymous,
Modify the formula as below:
Avg7DayGas = VAR previous_7_date = Table1[RecordDate] - 7 VAR current_date = Table1[RecordDate] RETURN CALCULATE ( SUM ( Table1[NetFlowRate] ), FILTER ( Table1, Table1[RecordDate] > previous_7_date && Table1[RecordDate] <= current_date ) ) / 7
Regards,
Jimmy Tao
@Anonymous,
In power bi, you can create a calculate column using DAX below:
Avg7DayGas = VAR previous_7_date = Table1[RecordDate] - 7 VAR current_date = Table1[RecordDate] RETURN CALCULATE ( AVERAGE ( Table1[NetFlowRate] ), FILTER ( Table1, Table1[RecordDate] > previous_7_date && Table1[RecordDate] <= current_date ) )
Regards,
Jimmy Tao
@Anonymous,
I don't want to generate a table for this calculation. Values are not coming as correct, when i do the table operation. I want the record date to be descending order and based on record date i need to show preceding 7 days average as single record as per the below SSRS report code. I am able to see the correct values in SSRS report. SELECT ProductionDate,Netflowrate, SUM (GasProduction/7) OVER (ORDER BY RecordDate ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS Avg7DayGas Thanks
Your clarification of your requirement is not so clear. Can you show the output table you want?
Regards,
Jimmy Tao
@Anonymous,
Modify the formula as below:
Avg7DayGas = VAR previous_7_date = Table1[RecordDate] - 7 VAR current_date = Table1[RecordDate] RETURN CALCULATE ( SUM ( Table1[NetFlowRate] ), FILTER ( Table1, Table1[RecordDate] > previous_7_date && Table1[RecordDate] <= current_date ) ) / 7
Regards,
Jimmy Tao
I tried your query in below screen shot it is giving me as same as gas production(net flow rate). I want the output as 464.
Hi @v-yuta-msft
When i create the below measure in 3rd screen shot it is working fine as it is giving output as 1 aggregated record. I tried the same in live connection ( created measure in cube itself like 4th screen shot) it is not working fine. It is splitting into 7 records( 1st screen shot.)
Desired Result: (Import working fine)- 2nd & 3rd Screen shot.
Power Bi Import method the below query returning exact output as mentioned in 2nd screen shot.
Cube query not working in Power BI- 1st & 4th Screen shot.
I written the same logic in SSAS Tabular Cube as a measure except allselected(Table) but it is not giving exact output like 2nd screen shot. I am not able to replicate the same because in live connection has many tables i am not able to replicate all tables in allselected function.
It is working fine now. Thanks Jimmy for your reply.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |