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
sharpedogs
Advocate II
Advocate II

New Column that returns a single value based on date?

Hi, 

I have the below data set with dates as to when a customer filled out a survey. I want to create two new columns that shows me their response based on The First Survey they filled out (earliest date). Then a second new column that does the same but shows the response for the last survey they filled out. 

 

I've tried a bunch of claculations using values and first/last date. But i can't seem to get it correct. 

 

Customer

Date

ResponseOUT PUT (First Response)
ChadJan 1st 2020ProPro
SamJan 5th 2020DetractDetract
ChadJan 9th 2020Pas Pro
ChadJan 11th 2020PasPro
SamJan 2th 2020ProPro
DaveJan 4th 2020PasPas
DaveJan 1st 2020PasPas

 

6 REPLIES 6
lbendlin
Super User
Super User

Here's a slightly more noble version

 

First Response =
var c = [Customer]
var f = minx(filter(Surveys,[Customer]=c),[DateValue])
return minx(filter(Surveys,[DateValue]=f && [Customer]=c),[Response])
 
What do you expect to happen when the user submits multiple surveys on the same day?

A customer (person) is only sent one survey a quarter. So there is no issue with multiple on the same day.   

lbendlin
Super User
Super User

Here is a very crude variation.  I know this can be improved with LASTNONBLANKVALUE but i need to re-learn that.

 

lbendlin_0-1611723177475.png

Also, "Jan 2th" - really?!

i was doing it at 11pm.. after spening 2 hours messing around with it.. give me a break...lol.. I'll try your solution below..

 

thanks

 

lbendlin
Super User
Super User

Power Query or DAX?  Calculated Column or Measure?

I need to show the values in a column. So either PowerQ or, calculated column or a new formular column would work. 

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.