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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
kyleldi
Frequent Visitor

Best Way to Create a percentage by month?

Hello, I'm new to Power BI, and I have a bunch of deliveries in a delivery table that I'm trying to graph with an on time delivery approach.  I've figured out how to use the bin function to group my data together by month, and in turn group my three possible job statuses by status as well, but from there, I do not understand how to write a formula to calculate them.  Ultimately I'm looking to create a graph that shows month and on time delivery percentage.  Any assistance would be gratefully appreciated!

 

Capture.JPG

4 REPLIES 4
Greg_Deckler
Super User
Super User

Could you supply some raw data or sample data and explain how on time is calculated? It sounds like what you want is a measure like:

 

MyPercent = CALCULATE(COUNT([Job]),FILTER(Table,ALLEXCEPT([Shipped_Date],[OTD_Status]))) / CALCULATE(COUNT([Job]),FILTER(Table,ALLEXCEPT([Shipped_Date])))

Something along those lines.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Here is a snapshot of some of the data.  I've used a column (OTD_Status) to calculate whether the ship date was ontime/late/early.  At least that's how I'm used to doing it in MSQuery/Excel.  This is data that comes directly out of our SQL Database.Capture3.JPG

 

 

 

 

 

 

 

 

 

kyleldi
Frequent Visitor

So far the best I have come up with calculates the number of status' that meet the "Early" requirement, as you can see in the attached screenshot.  At this point it is counting all of them without factorying the date that I have filtered in the first column of this table.  Ultimately this group of dates (months) can/will change as the user uses the slider bar.

 

Early = CALCULATE(COUNTA('vw_PBI-OnTimeDelivery'[OTD_Status]),FILTER(ALL('vw_PBI-OnTimeDelivery'),'vw_PBI-OnTimeDelivery'[OTD_Status]="Early"))

Capture2.JPG

 

 

You want to create your calculations as measures rather than columns.  The binning that you appeared to do manually(?) can be accomplished with a date table (use the CALENDAR function).

 

Can you provide some of the raw data that you are working with? 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.