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

Percentage delivered by country by day gives 100%

Hi All,

 

First time posting, hope someone can help me.

 

I am creating a Proof of Delivery (POD) report based on parcels being delivered to multiple countries in Europe.

 

I have the following data sources:

DHL Data - this is the master data list from the carrier and includes the Campaign Reference, Store Number, Delivery Date, Count of Parcels (along with others)

Store Lookup - Store number, country

Despatch Tracker - Campaign Reference, Despatch Date

Calendar Table - Cos' you have to have a calendar table, its the law.

 

When I have one campaigns worth of data, all works fine. I can work out the percentage of parcels that drop on each day following despatch (by country, as weekdays only)

 

DaveBonehill_0-1598972221866.png

The cardinality between DHL Data and Store Lookup is 1:1.

 

The problems start when I add in more campaigns, I have to change the cardinality to 1:Many which then makes all of the despatches 100% - it delivered 2 parcels of 2 on the date specified, rather than 2 parcels of the total of 23.

 

DaveBonehill_1-1598972380583.png

 

DaveBonehill_2-1598972465357.png

 

If I need to post more info then please let me know.

 

Thanks

 

Dave

 

1 ACCEPTED SOLUTION

Hello, @DaveBonehill

Please try the next step to see if it works.

Percentage Delivered =
DIVIDE (
    CALCULATE ( COUNTROWS ( DHL ), DHL[Status] = "Shipment Delivered" ),
    CALCULATE ( SUM ( DHL[Packs] ), ALLSELECTED ( DHL ) )
)

Best regards

Allan

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@DaveBonehill , Can you share sample data and sample output in table format?

Hi,

 

cannot share all as there is sensitive data in but here are some downloads of what i believe is relevent.

 

Store Lookup

Store NumberStore Country
27 PORTUGAL
32 PORTUGAL
50 SPAIN
53 PORTUGAL
66 GERMANY
67 NETHERLANDS
71 NETHERLANDS
78 NETHERLANDS
93 GERMANY
111 NETHERLANDS
126 IRELAND
132 NETHERLANDS
157 FRANCE
219 NETHERLANDS
224 BELGIUM
232 NETHERLANDS
262 NETHERLANDS
278 GERMANY
287 PORTUGAL
316 PORTUGAL
325 NETHERLANDS

 

DHL Data

Store NumberLast Event date.1Packs
102621/08/2020 00:001
103120/08/2020 00:001
105920/08/2020 00:001
106520/08/2020 00:001
107220/08/2020 00:001
107620/08/2020 00:001
107720/08/2020 00:001
110220/08/2020 00:001
111220/08/2020 00:001
113320/08/2020 00:001
114420/08/2020 00:001
114620/08/2020 00:001
114720/08/2020 00:001
115020/08/2020 00:001
115121/08/2020 00:001
116020/08/2020 00:001
116321/08/2020 00:001
118721/08/2020 00:001
120020/08/2020 00:001
120320/08/2020 00:001
122220/08/2020 00:001
124820/08/2020 00:001
12620/08/2020 00:001
126420/08/2020 00:001
127420/08/2020 00:001
133620/08/2020 00:001
135220/08/2020 00:001
136720/08/2020 00:001
140120/08/2020 00:001
141320/08/2020 00:001
142320/08/2020 00:001

 

 

 

Output looks like this but it needs ti show percentage of overall count (by country)

 

DaveBonehill_0-1598976872503.png

 

Pragati11
Super User
Super User

HI @DaveBonehill ,

 

Can you share calculation of "Percentage Delivered" metric?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi Pragati,

 

Percentage Delivered =
DIVIDE([Packs Delivered],SUM(DHL[Packs]))
 
Packs Delivered =
var _packs=CALCULATE(COUNTROWS(DHL), DHL[Status] = "Shipment Delivered")
return
IF(ISBLANK(_packs),0,_packs)
 
thanks
dave
 

I have updated the percentage delivered measure to the following which has meant i can change the cardinality to 1:Many. This has allowed me to add more data into the table.

 

Percentage Delivered =
DIVIDE(CALCULATE(COUNTROWS(DHL), DHL[Status] = "Shipment Delivered"),CALCULATE(SUM(DHL[Packs]),ALLEXCEPT(DHL,DHL[Last Event date.1])))
 
the problem now is that the main visual works until i select a campaign or country. The calculation is still being performed on the entire pack count rather than the selected filters.
 
With nothing selected i get this (which is what i expect):
clip 1.png
When i select a campaign or country i get this:
clip 2.png
 

Hello, @DaveBonehill

Please try the next step to see if it works.

Percentage Delivered =
DIVIDE (
    CALCULATE ( COUNTROWS ( DHL ), DHL[Status] = "Shipment Delivered" ),
    CALCULATE ( SUM ( DHL[Packs] ), ALLSELECTED ( DHL ) )
)

Best regards

Allan

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Many thanks Allan.

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.