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
mohsin-raza
Helper III
Helper III

Calculate distance covered by car between two choice dates

Hi!

 

I have an example table have cars odometer .

 

DateOdometer
 17 /10/202175475
 18 /10/202194473
 19 /10/2021117646
 20 /10/2021130786
 21 /10/2021146211
 22 /10/2021158427
 23 /10/2021169678
 24 /10/2021175888
 25 /10/2021187905
 26 /10/2021201116
 27 /10/2021216144
 28 /10/2021229888
 29 /10/2021245463
 30 /10/2021259002

 

 

I will make the repport like below so that we choice first and last date and will find the distance covered between given dates .

 

Can i get a good solution?

 

Solution.jpeg

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @mohsin-raza ,

Please have a try.

Create a new table based on the table first.

Table 2 = SUMMARIZE('Table','Table'[Date],'Table'[Odometer])

Then cteate three measures.

start_odometer = CALCULATE(MAX('Table'[Odometer]),FILTER(ALL('Table'),'Table'[Date]=SELECTEDVALUE('Table'[Date])))
end_odometer = CALCULATE(MAX('Table 2'[Odometer]),FILTER(ALL('Table 2'),'Table 2'[Date]=SELECTEDVALUE('Table 2'[Date])))
result = 'Table'[end_odometer]-[start_odometer]

vpollymsft_0-1655793574976.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

9 REPLIES 9
v-rongtiep-msft
Community Support
Community Support

Hi @mohsin-raza ,

Please have a try.

Create a new table based on the table first.

Table 2 = SUMMARIZE('Table','Table'[Date],'Table'[Odometer])

Then cteate three measures.

start_odometer = CALCULATE(MAX('Table'[Odometer]),FILTER(ALL('Table'),'Table'[Date]=SELECTEDVALUE('Table'[Date])))
end_odometer = CALCULATE(MAX('Table 2'[Odometer]),FILTER(ALL('Table 2'),'Table 2'[Date]=SELECTEDVALUE('Table 2'[Date])))
result = 'Table'[end_odometer]-[start_odometer]

vpollymsft_0-1655793574976.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

@v-rongtiep-msft 

one more question please

If we like to sum of odometer from one selected date to another selected date, are we used same logic?

i am trying datebetween().so that i can find the sum between two selected dates.

@v-rongtiep-msft  Thanks alot for helping. The same logic is implemented for the solution of my problem.

@v-rongtiep-msft  first thanks for help and i try to implement the same logic on whole dataset then let you know please! 

mohsin-raza
Helper III
Helper III

Hello again:

 

Here is the rapport view where date is selected and corresponding car odometer on the date shows in Card Visual  ,when user select second date the corresponding car odometer  is shown in the Card visual  of the  selected  date .

 

Thinking is to calculate the difference between these two values  and display in the third Card Visual. 

@Admin 

 

Can i get some solution of  this concept?

 

Regards.

 

Task.jpeg

mh2587
Super User
Super User

what will be the selected duration between start and end date


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Thanks Hasnain for reply.Duration will number of days.

more explanation: when start date is selected , corresponding odometer values need to show  odometer (textbox)/card same when end data is selected ,the corresponding odometer value will show.

 

Odometer difference need to be display in the card:

 

I am asking what will be the range of duration mean for the month or 2 months etc


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



 

Can you please see the table ?

Range is the Date column.

I think you are asking for this   

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.