Forum Discussion
Need help with Dax calculation : For 4 Quarter Rolling%
Here's my Sample data ,
Index Year Quarter Response Date NPS Group
| 1 | 2025 Q1 | 2025-01-15 | Promoter |
| 2 | 2025 Q1 | 2025-01-15 | Passive |
| 3 | 2025 Q1 | 2025-01-15 | Detractor |
| 4 | 2025 Q1 | 2025-01-22 | Promoter |
| 5 | 2025 Q1 | 2025-01-22 | Passive |
| 6 | 2025 Q1 | 2025-01-22 | Detractor |
| 7 | 2025 Q1 | 2025-01-29 | Promoter |
| 8 | 2025 Q1 | 2025-01-29 | Passive |
| 9 | 2025 Q1 | 2025-01-29 | Detractor |
| 10 | 2025 Q2 | 2025-04-05 | Promoter |
| 11 | 2025 Q2 | 2025-04-05 | Passive |
| 12 | 2025 Q2 | 2025-04-05 | Detractor |
| 13 | 2025 Q2 | 2025-04-12 | Promoter |
| 14 | 2025 Q2 | 2025-04-12 | Passive |
| 15 | 2025 Q2 | 2025-04-12 | Detractor |
| 16 | 2025 Q2 | 2025-04-19 | Promoter |
| 17 | 2025 Q2 | 2025-04-19 | Passive |
| 18 | 2025 Q2 | 2025-04-19 | Detractor |
| 19 | 2025 Q3 | 2025-07-10 | Promoter |
| 20 | 2025 Q3 | 2025-07-10 | Passive |
| 21 | 2025 Q3 | 2025-07-10 | Detractor |
| 22 | 2025 Q3 | 2025-07-17 | Promoter |
| 23 | 2025 Q3 | 2025-07-17 | Passive |
| 24 | 2025 Q3 | 2025-07-17 | Detractor |
| 25 | 2025 Q3 | 2025-07-24 | Promoter |
| 26 | 2025 Q3 | 2025-07-24 | Passive |
| 27 | 2025 Q3 | 2025-07-24 | Detractor |
| 28 | 2025 Q4 | 2025-10-05 | Promoter |
| 29 | 2025 Q4 | 2025-10-05 | Passive |
| 30 | 2025 Q4 | 2025-10-05 | Detractor |
In need to calculate % of Promoters , Passive , Detractors in Power BI ,
The formula for Promoter % is (Count of Promoters / Total Count )*100
My requirement is if I click on 2024 Q3, My Rolling $ Quarter _ Promoter % = ( Count of Promoters for Q3 2024 +Q2 2024+Q1 2024+Q4 2023)/(Total Count for Q3 2024 +Q2 2024+Q1 2024+Q4 2023)*100
In the above sample data i have pasted if I click Q4 2024 in my slicer , I should get Rolling Promoter % ( Q4 2024+Q3 2024+Q2 2024+ Q1 2024)
My output should be in the below format :
Year Quarter Promoter % Passive % Detractor %
| 2025 Q'1 | |||
| 2025 Q'2 | |||
| 2025 Q'3 | |||
| 2025 Q'4 |
Hi ProdPal ,
Based on the sample data Below is the result.
And the measure is:
Rolling $ Quarter _ Promoter % = var stat = max('Table'[ Response Date])-365 var B = date(year(stat),month(stat),1) RETURN calculate(COUNT('Table'[NPS Group]),ALLEXCEPT('Table','Table'[NPS Group]),'Table'[ Response Date]>=B,'Table'[ Response Date]<=max('Table'[ Response Date]))TO get the percentage, go to the value pane, put show value as percentage of row total.
Let me know If this works. Plz accept as solution if works.
Hi ProdPal ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Rupak_bi for the prompt response.
I have created PBIX file using sample data, please go through the attached PBIX file.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly.
Thank you.
Hi ProdPal ,
I wanted to check if you had the opportunity to review the information provided.If the response has addressed your query, please accept it as a solution, so other members can easily find it.
Thank you.
4 Replies
- Rupak_bi
Super User
Hi ProdPal ,
Based on the sample data Below is the result.
And the measure is:
Rolling $ Quarter _ Promoter % = var stat = max('Table'[ Response Date])-365 var B = date(year(stat),month(stat),1) RETURN calculate(COUNT('Table'[NPS Group]),ALLEXCEPT('Table','Table'[NPS Group]),'Table'[ Response Date]>=B,'Table'[ Response Date]<=max('Table'[ Response Date]))TO get the percentage, go to the value pane, put show value as percentage of row total.
Let me know If this works. Plz accept as solution if works.
- v-venuppu
Community Support
Hi ProdPal ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Rupak_bi for the prompt response.
I have created PBIX file using sample data, please go through the attached PBIX file.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly.
Thank you.
- ProdPalNew Member