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

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.

Reply
Anonymous
Not applicable

Not Sure What I'm doing Wrong

Can anyone spot what the issue is? I'm trying to calculate a trailing 12 month average. Here are the pieces involved. I will be more than happy to clarify anything because I've been stuck on this for weeks:


Count of survey results considered "positive":
1.PNG

Count of all survey results (positive, neutral, negative)

1.PNG

Percentage of positive feedback:

1.PNG

Attempt at calculating trailing 12 month average:

1.PNG

 

Results:

1.PNG

The results should definitely not be 100% for every month...

 

1 ACCEPTED SOLUTION

I've done something similar using different DAX (syntax may be a bit off)

 

You could put an offset column in your date table with inactive relationship:

Offset Month = DATE('Calendar'[SOM].[Year]-1,'Calendar'[SOM].[MonthNo],'Calendar'[SOM].[Day])

 

Then:

Trailing 12 Month Average = SUMX('All Survey Data',CALCULATE(SUM('All Survey Data'[Positive Feedback]),
    FILTER('All Survey Data','All Survey Data'[Start Date]<=CALCULATE(MIN('Calendar'[Start Date]))&&'All Survey Data'[Start Date]>=MAX('Calendar'[Offset Month]))) / [All Groups]

 

 

View solution in original post

4 REPLIES 4
Aron_Moore
Solution Specialist
Solution Specialist

Could you put the other measures in that table as well to see if they're calculating correctly?

Anonymous
Not applicable

@Aron_Moore Sure thing:

1.PNG

I've done something similar using different DAX (syntax may be a bit off)

 

You could put an offset column in your date table with inactive relationship:

Offset Month = DATE('Calendar'[SOM].[Year]-1,'Calendar'[SOM].[MonthNo],'Calendar'[SOM].[Day])

 

Then:

Trailing 12 Month Average = SUMX('All Survey Data',CALCULATE(SUM('All Survey Data'[Positive Feedback]),
    FILTER('All Survey Data','All Survey Data'[Start Date]<=CALCULATE(MIN('Calendar'[Start Date]))&&'All Survey Data'[Start Date]>=MAX('Calendar'[Offset Month]))) / [All Groups]

 

 

Anonymous
Not applicable

@Aron_Moore Ok cool. I will set this up and give it a try. Thank you so much!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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