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
mark_carlisle
Advocate IV
Advocate IV

Previous NPS to enable calculation of change

I have the following example data;

 

Survey IDCreated DateCustomer NameCSAT ScoreCSATFCRValueFCR TexttNPS ScoretNPS TexttNPSValuetNPSSurveyAccount NumberAccount NameAccount TypeTerritoryFCR TargetCSAT TargetNPS Target
UKI0000119 June 2019Mark10100.0%100.0%One Time8Neutral0True12345678Comp 1CustomerUnited Kingdom90.0%90.0%60.0
UKI0000213 June 2019Mark990.0%100.0%One Time9Promoter10True12345678Comp 1CustomerUnited Kingdom90.0%90.0%60.0

 

We can see that the customer has had two surveys and the first survey they were a NPS Promoter, on the latest survey they are an NPS Neutral. What I would like to do in DAX if possible is to have a calculated column that would show the previous tNPSText as shown below. Is this possible?

 

Survey IDCreated DateCustomer NameCSAT ScoreCSATFCRValueFCR TexttNPS ScoretNPS TexttNPSValuetNPSSurveyAccount NumberAccount NameAccount TypeTerritoryFCR TargetCSAT TargetNPS TargetPrevioustNPSText
UKI0000119 June 2019Mark 10100.0%100.0%One Time8Neutral0True12345678Comp 1CustomerUnited Kingdom90.0%90.0%60.0Promoter
UKI0000213 June 2019Mark990.0%100.0%One Time9Promoter10True12345678Comp 1CustomerUnited Kingdom90.0%90.0%60.0 

 

The actual data contains many customers and potentially many surveys for each customer, it is specifically the survey immediately prior to the latest survey I'm interested in.

 

Thanks

1 ACCEPTED SOLUTION

Hi @mark_carlisle ,

Try the formula below. If you need to add other limiting conditions, you can reference "&& 'Table 1'[Created Date] < EARLIER('Table 1'[Created Date] )".

PrevioustNPSText = CALCULATE(MAX('Table 1'[tNPS Text]),FILTER('Table 1','Table 1'[Customer Name] = EARLIER('Table 1'[Customer Name]) && 'Table 1'[Created Date] < EARLIER('Table 1'[Created Date] )))

1.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
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

4 REPLIES 4
amitchandak
Super User
Super User

Hi @mark_carlisle,

Both tables are almost same. can you please hightlight what is need.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I've highlighted in red the new column I would like to create. The record in the first row for this new column contains the previous tNPSText for this customer, the record in the second row contains a null or blank beacuse this was the first survey for this customer.

Hi @mark_carlisle ,

Try the formula below. If you need to add other limiting conditions, you can reference "&& 'Table 1'[Created Date] < EARLIER('Table 1'[Created Date] )".

PrevioustNPSText = CALCULATE(MAX('Table 1'[tNPS Text]),FILTER('Table 1','Table 1'[Customer Name] = EARLIER('Table 1'[Customer Name]) && 'Table 1'[Created Date] < EARLIER('Table 1'[Created Date] )))

1.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Just realise there was a horizontal scroll too 

 

Please refer

https://community.powerbi.com/t5/Desktop/Obtain-the-last-value-in-a-column/td-p/306289

https://community.powerbi.com/t5/Desktop/Last-value-with-condition/td-p/455752

https://community.powerbi.com/t5/Desktop/Latest-Value/td-p/101257

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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