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
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.

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.

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.