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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Anonymous
Not applicable

@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

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@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

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!

Anonymous
Not applicable

@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

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors