98.8% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Power BI training and help » Measures
Measures
Resolved · Medium Priority · Version 365
Patrycja has attended:
Excel Intermediate course
Power BI Reporting course
Measures
Good morning, I'm hoping you could help.
I have an Excel table showing a list of all different suppliers, dates, spend etc.
One of the column is 'On Time Delivery', returning either 'Y' or 'N' based on the formula.
What I'm trying to achieve is to have Power BI calculating the % of 'Y' for each supplier and then to visualize that.
Another thing would be total spend of 'Y' lines for each suppliers.
I know how to achieve that in excel using formulas, however I'm having troubles displaying that in Power BI.
I'd be more than happy to send my Excel file across if that would help coming up with any ideas.
The outcome is to have a comparison of total spend for each supplier vs on time delivery 'Y' for each supplier.
Any help much appreciated.
Thank you!
RE: Measures
Hi Patrycja,
Thank you for the forum question.
I'd be happy to help you with your Power BI measures. Let's break down the steps to achieve what you're looking for:
1. Calculating the % of 'Y' for Each Supplier
First, you'll need to create a measure to calculate the percentage of 'Y' values for each supplier.
Create a new measure for the count of 'Y':
CountY = CALCULATE(COUNTROWS(YourTable), YourTable[On Time Delivery] = "Y")
Create a measure for the total count of deliveries:
TotalDeliveries = COUNTROWS(YourTable)
Create the percentage measure:
PercentageOnTime = DIVIDE([CountY], [TotalDeliveries], 0)
2. Calculating Total Spend of 'Y' Lines for Each Supplier
Next, you'll need a measure to calculate the total spend for 'Y' lines.
Create a measure for the total spend of 'Y' lines:
TotalSpendY = CALCULATE(SUM(YourTable[Spend]), YourTable[On Time Delivery] = "Y")
3. Visualizing the Data
Now, you can visualize these measures in Power BI:
Create a table or matrix visual:
Add Supplier to the rows.
Add PercentageOnTime and TotalSpendY to the values.
Create a bar chart or other visual to compare total spend vs. on-time delivery:
Add Supplier to the axis.
Add TotalSpendY and PercentageOnTime to the values.
This should give you a clear comparison of total spend for each supplier versus their on-time delivery performance.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
RE: Measures
Hi Jens, that's great thank you so much!
Just wanted to double check before I start.
Let's say I have a list with 200 rows, each row represents a product bought from a supplier, which means there's not necessarily 200 suppliers, as we might have bought multiple products from the same one.
I'm looking to find a % of 'Y' from 'On Time Delivery' column for each supplier, not for the total of rows.
It is the same with total spend, it would be for each supplier, not for the total of rows.
Would these measures still work? I'm sorry if this is a bit confusing.
Appreciate your support!
RE: Measures
Hi Patrycja,
If you add suppliers to row in a matrix, the DAX will filter the rows for each supplier.
Create the matrix and do this measure:
CountY = CALCULATE(COUNTROWS(YourTable), YourTable[On Time Delivery] = "Y")
I do not know the names of your tables and headings, so you will need to amend the DAX to your names.
If you add the measure to values of the matrix you will see it will return the number of transactions (rows) for each supplier where you have YES.
Then you can build the rest of the DAX.
If you want more knowledge of DAX we have a DAX course.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
RE: Measures
I will have a go now, thank you so much Jens that's perfect!
RE: Measures
It seems to work perfectly.
Last one, I hope - how do I display % instead of decimal in visuals?
Thank you!
RE: Measures
Hi Patrycja,
Select the measure (nothing to do with the tick box click on the name of the measure). Look at your ribbon at the top and here you will find the formatting options. Click %.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Power BI tip:General ShortcutsCtrl + S: Save the report or dashboard. |