Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

translate import logic into direct query

Hi guys,

in direct query an sql server is giving me a table with time stamps and task names.

i now need to subtract these time stamps from each other.

See sample data: 
Sample Data.JPG

1) Created unique ID in the correct order  (measure)

2) Created unique ID VGL 1 (measure)

Now i need a formula for the following logic:
Zeitstempel for ID - Zeitstempel for ID VGL 1

 

3) Logic before direct query mode

In Import mode i duplicated my source table, did the steps 1) and 2) (calculated column) and linked them by ID 1:1 ID VGL 1.

This method isnt working bc i cant link measures.

 

I dont know what to do know..

Would appreciate some help.

 

Kind regards

Philipp

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

What is the logic of your Measure ID1 and ID2?

Maybe you can refer the pbix that attached.

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

 

It will be helpful if you can show us the exact expected result based on the tables. Please upload your files to OneDrive For Business and share the link here.

 

Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

amitchandak
Super User
Super User

@Anonymous , try like 

measure =
datediff(max(Table[zetistempel]), calculate(max(Table[zetistempel]), filter(allselected(Table), Table[zetistempel] <max(Table[zetistempel]) && Table[ID] =max(Table[ID]))),second)

or 

measure =
datediff(max(Table[zetistempel]), calculate(max(Table[zetistempel]), filter(allselected(Table), Table[VGL] =max(Table[VGL])-1 && Table[ID] =max(Table[ID]))),second)

Anonymous
Not applicable

@amitchandak , yet it isnt working like it should.

Measure Forum.JPG

again, the measure needs to subtract the 2 time stamps for ID.1 = ID.2.

e.g. Calculate Time Stamp for ID.1 = 50

 

1) measure needs to look up ID.1 = 50 in ID.2.

2) measure needs to subtract "Zeitstempel" for ID.1 = 50 and ID.2 = 50.

 

I cant find a solution to this, would really appreciate your help.

 

amitchandak
Super User
Super User

@Anonymous , you have to try a measure like

measure =
datediff(max(Table[zetistempel]), calculate(max(Table[zetistempel]), filter(allselected(Table), Table[zetistempel] <max(Table[zetistempel]))),second)

Anonymous
Not applicable

@amitchandak , thanks for the formula.

yet it doesnt contain the most important part in this logic:
I need to get the difference between the Time Stamps for ID = ID VGL 1.
Sample Calculation.JPG

 

maybe this visual makes it clearer.

 

Thank you!!

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.