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

calculate the distance between ATM and several other ATM

have an ATM database (Gainful of ATM, address, city, city type, longitude, latitude, ID_GAB, ....)

Capture1.PNG

The goal is to remove the maximums  of ATM according to 2 condition:

1-the distance must not exceed 500 meters (example)

Capture2.PNG

2-Find the least profitable ATM to delete it (example)

Capture3.PNG

I found a MEASURE which calculates between 2 distance  😃  

But I do not know how to write a loop that goes from a less profitable ATM and make a comparison with others if it is the most unprofitable we delete it and move on to the 2nd ATM ect ...

 

Capture4.PNG

 

THANK YOU ! 

 

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create two measures as below.

divide = 
CALCULATE (
    DIVIDE ( MAX ( 'Table'[Gainful of ATM] ), MAX ( 'Table'[distance] ) ),
    FILTER ( 'Table', 'Table'[distance] <= 500 )
)
Action = 
IF ( [divide] = MINX ( ALL ( 'Table' ), [divide] ), "ATM REMOVE", BLANK () )

Capture.PNG

 

 

We can create two measures as below to get the excepted result.

divide = 
CALCULATE (
    DIVIDE ( MAX ( 'Table'[Gainful of ATM] ), MAX ( 'Table'[distance] ) ),
    FILTER ( 'Table', 'Table'[distance] <= 500 )
)
Action = 
IF ( [divide] = MINX ( ALL ( 'Table' ), [divide] ), "ATM REMOVE", BLANK () )
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

 @v-frfei-msft  can you help me to make a loop that calculates the distance between an ATM and several other before making the condition on the distances

 

(adresse1)---(adresse2)

(adresse1)---(adresse3)

(adresse1)---(adresse4)

(adresse1)---(adresse5)

next

(adresse2)---(adresse1)

(adresse2)---(adresse3)

(adresse2)---(adresse4)

(adresse2)---(adresse5)

 

this is fonction for calculat :

Capture5.PNG

Calcule_distance.pbix

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.