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

clean up data set with two records for one questionnaire

Hi,

 

I hope you can help me out with the following issue. 

I have a dataset with questionnaire data. For each questionnaire sent, a record is created with a date it was sent at (date sent). When someone fills out the questionnaire, a new record is created with a responde date (date response) added. I want to filter out the initial records of questionnaires that have been filled out but also keep the records that haven't been filled out yet and therefore only have one record. When I filter on date response, I would lose te records that haven't yet been filled out. 

The goal is to clean up the dataset and to create measures that would calculate the number of questionnaires sent out, how many were sent back and how many are still waiting for response. I have created an example:

 

questionnaire_idsubjectdate sentdate response
100a1-1-2020 
100a1-1-202014-1-2020
101b2-1-2020 
102c6-1-2020 
102c6-1-20208-1-2020

 

I want the result to be something like this:

100a1-1-202014-1-2020
101b2-1-2020 
102c6-1-20208-1-2020

 

I hope you can help me out.

 

Regards,

 

Shipova

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to create a calculated column:

Column = CALCULATE(FIRSTNONBLANK('Table (2)'[date response],0),ALLEXCEPT('Table (2)','Table (2)'[questionnaire_id]))

V-lianl-msft_0-1598595598196.png

 

 

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

Anonymous
Not applicable

Unfortunately this doesn't work. It filters out the questionnaires that don't have a response date yet but all other records are still there.

 

amitchandak
Super User
Super User

@Anonymous , Create new table

summarize(Table, Table[questionnaire_id], Table[subject], Table[date sent] , "date response" , lastnonblank(Table[date response],blank()))

or

summarize(Table, Table[questionnaire_id], Table[subject],"date sent", min( Table[date sent]) , "date response" , lastnonblank(Table[date response],blank()))

 

or use measures

min( Table[date sent])

lastnonblank(Table[date response],blank())

with questionnaire_id and subject

Anonymous
Not applicable

unfortunately this didn't work. I get the same table without the date response column.

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.