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
NabihaF
Frequent Visitor

Calculations within the same column and related column

Hello, 

 

I have data in this format:

NabihaF_0-1652952382005.png

I want to calculate the difference between the date linked to first_open and the date linked to app_remove.

How can i do that? is it possible?

 

1 ACCEPTED SOLUTION

Hi:

Please see file for calc column. I hope this is a good solution for you!

https://drive.google.com/file/d/1bwbHewq0a3b0qU1oK9ntS5CK-yFAUSxL/view?usp=sharing 

Whitewater100_0-1652983801337.pngWhitewater100_1-1652983850904.png

 

View solution in original post

8 REPLIES 8
Whitewater100
Solution Sage
Solution Sage

Hi:

I assume you want that difference based on the user id field?

 

Can you send example data with some ID;s that have user_action with both dates? It will be easier to work on data example.

Thanks..

Hi, here you go:

 

user_pseudo_iduser_actionevent_date
00501ccd007a26fe4eb0e5ba77d34adeapp_remove03/05/2022
00ad8194133c426cffb6ec2aa3deb745app_remove03/05/2022
009fab1c9b03791fc35fb8d9dac5a6faapp_remove29/04/2022
00f8357f1414565d7fe4d9765c3f3f83app_remove29/04/2022
01cd6bc125b85f286efd0ff3350ddbeaapp_remove30/04/2022
000de56dc6fc2f6acd858670eaf37750app_remove30/04/2022
01642376dc47a6ae2c6483fc716bcb8eapp_remove30/04/2022
0162782356cacc87d12a750eb0eeed08app_remove30/04/2022
018739eeb0d82786062ec4e67c4f68b1app_remove01/05/2022
02239ab06d6e2329ceffb918bae34475app_remove01/05/2022
00ad8194133c426cffb6ec2aa3deb745first_open03/05/2022
02239ab06d6e2329ceffb918bae34475first_open01/05/2022
018739eeb0d82786062ec4e67c4f68b1first_open01/05/2022
009fab1c9b03791fc35fb8d9dac5a6fafirst_open06/04/2022
0162782356cacc87d12a750eb0eeed08first_open21/04/2022
01642376dc47a6ae2c6483fc716bcb8efirst_open24/04/2022

Hi:

Please see file for calc column. I hope this is a good solution for you!

https://drive.google.com/file/d/1bwbHewq0a3b0qU1oK9ntS5CK-yFAUSxL/view?usp=sharing 

Whitewater100_0-1652983801337.pngWhitewater100_1-1652983850904.png

 

Hi,

 

Thank you so much!.

 

This looks good, but i need to try it out at my end. Just a quick question though, can i still insert a calculated column even though the data is coming in via direct query?

Yes, unfortunately it is not working on direct query...

NabihaF_0-1653031050704.png

 

Is there any other way to make this query?

Hi:

I did not relaize DQ. I know it is more limited. I've tried another way which is on the attached file. If you could do import, it's easier for modeling. I will paste link on limitations of DQ.

https://drive.google.com/file/d/1bwbHewq0a3b0qU1oK9ntS5CK-yFAUSxL/view?usp=sharing 

 

Using DirectQuery in Power BI - Power BI | Microsoft Docs

 

I hope you can mark original question as solved.. Thanks

Will it be possible for you to please explain this soltuion. I see youve created two new tables?App remove and app open?

Hi:

I created the two tables as a way to use LOOKUPVALUE to finangle open & close date on same line. Then it's easier to subtract the date values.

 

I'm not using DQ (only) very much and understand it is good to use if you have massive data or you need updated reslts quite often. This was simply another approach I tried to get you the answer.

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.

Top Solution Authors