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
ledoyle1121
Frequent Visitor

Time Intelligence - comparing this year to last year with a custom measure

Hi,

 

I have a report where I am trying to compare a team's Net Promoter Score % for this year and last year. The NPS value I am displaying is a custom measure that I've created which is: 

NPS = ('Direct Query - NPS'[NPS Promoter %]-[NPS Detractor %])

 

I've tried to calculate it a few different ways, the most recent being in this format: 

*NPS = CALCULATE([NPS])
*NPS Score Previous Year = CALCULATE([NPS],SAMEPERIODLASTYEAR(DATE_DIM[CALENDR_DATE]))
*Diff in NPS This Year and Last Year = [*NPS]-[*NPS Score Previous Year]

 

However, the visuals don't seem to be producing the expected results. Instead of seeing percentages between 40% and 100%, I'm only pulling back "1" in my visual. 

 

Anyone have any idea why this is happening? 

Thanks!

Lauren

PS: I've saved the file to dropbox, but am not super familiar with providing others access... hopefully this link works, otherwise I can share via email
 https://1drv.ms/u/s!AhHYOkEMipXmaKSEep9s224HmoQ 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@ledoyle1121,

Create a visual using date field of DATE_DIM table, you will get correct results for *Diff in NPS This Year and Last Year . You can review the modified PBIX file to get more details.

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yuezhe-msft
Employee
Employee

@ledoyle1121,

Create a visual using date field of DATE_DIM table, you will get correct results for *Diff in NPS This Year and Last Year . You can review the modified PBIX file to get more details.

1.JPG

Regards,
Lydia

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

Hi Lydia,

Is it possible to see the pbix file, I'm trying to replicate this but i can't work out how you have done so.

 

David

Hi Lydia,

Thanks for this! I recreated the visual in my own file, using the sample you sent for reference. I'm wondering if you can help make sense of an error message I received when trying to drill down from the Year view to the Month:

"Couldn't load the data for this visual

MdxScript(Model) (67,71) Calculation error in measure 'Direct Query - NPS'[*NPS Score Previous Year]: Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion"

 

In the sample file, the error message gives the numbers 67 and 71, but in my actual file where I tried reproducing it, the error message indicates 71 and 71. I'm not quite sure how to interpret the message, and any help is greatly appreciated!

@ledoyle1121,

In your PBIX file, I have no issues when drilling down the chart using the highlighted button. Do you use CALENDR_DATE field of your DATE_DIM table as X-Axis and use the third button to drill down?

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lydia, 

Not sure why it was giving me trouble yesterday, because everything works fine now and I haven't made any changes to the file. Must have been a fluke. Thank so much for your help! 

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.