Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Dear Power BI Guru's
Being new to PBI , trying to resolve on situation at my end
Below is the requirement
The Sales orders should be shown at hourly basis, based on the city and Revenue per City.
Sales order is calculated on time / hourly basis
where as Revenue at city.
1:00 AM | 2:00 AM | 3:00 AM | 4:00 AM | 5:00 AM | 6:00 AM | 7:00 AM | 8:00 AM | 9:00 AM | 10:00 AM | 11:00 AM | Revenue | |
City | 123 | 23 | 21 | 12 | 34 | 54 | 23 | 35 | 90 | 78 | 67 | $4,500 |
I have added the Matrix to aggregate the sales orders at hourly but when i add the Revenue the matrix fails to add.
Little background:
Fact table with Sales order detail is joined with Dim calendar
One of the transaction datetime is split into hour column ex 2023-12-20 02:38:45 PM as 02:00 PM using dax
Based on the hour column we are aggregating the sales order in matrix.
Revenue is the sum(net sales)
Please revert if more info reqquired. Thanks!
Solved! Go to Solution.
revised method:
To address your requirement in Power BI, you need to create a matrix that shows sales orders at an hourly basis based on the city and also shows the revenue per city. The key is to ensure that you have the right relationship between your fact and dimension tables and then use DAX measures to aggregate data appropriately.
Here's a step-by-step guide to help you achieve this:
Make sure your data model in Power BI has the following:
You mentioned that you've already created an hour column. If not, you can create a calculated column or measure to extract the hour from the OrderDateTime field.
Sales Orders = COUNTROWS('SalesOrderDetail')
Revenue = SUM('SalesOrderDetail'[NetSales])
Ensure that relationships between your tables are correctly set up. The relationship should be based on the City and the Hour column you've created or the OrderDateTime column.
If adding both Sales Orders and Revenue in the Values field of the matrix causes issues with aggregation, you can create a separate matrix or table visual for Revenue. Alternatively, ensure that there's no conflict in the way you've structured your DAX measures.
By following these steps and ensuring that your data model and DAX measures are correctly structured, you should be able to create a matrix that displays sales orders at an hourly basis based on the city and also shows the revenue per city.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Hi @shri2785 ,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
It sounds like you want to create a matrix visual that shows the sales orders by hour and city, as well as the revenue by city. One possible solution is to use a measure that calculates the revenue for each city using the SUMX function. For example, you can create a measure like this:
Revenue by City = SUMX(VALUES('Fact Table'[City]), CALCULATE(SUM('Fact Table'[Revenue])))
This measure will iterate over the unique values of the city column in the fact table, and calculate the sum of the revenue for each city. You can then add this measure to the matrix visual, along with the sales order measure and the hour and city columns. You should see something like this:
City 1:00 AM 2:00 AM 3:00 AM 4:00 AM 5:00 AM 6:00 AM 7:00 AM 8:00 AM 9:00 AM 10:00 AM 11:00 AM Revenue by City
Lahore | 123 | 23 | 21 | 12 | 34 | 54 | 23 | 35 | 90 | 78 | 67 | $4,500 |
Karachi | 45 | 67 | 89 | 12 | 34 | 56 | 78 | 90 | 12 | 34 | 56 | $3,000 |
Islamabad | 34 | 56 | 78 | 90 | 12 | 34 | 56 | 78 | 90 | 12 | 34 | $2,500 |
I hope this helps you with your Power BI project.
Dear 123abc, thanks for your quick reply.
Yes i have implemented the SUMX as mentioned for revenue by city but now the challenge is that the Measure cant be added to Rows of Matrix visual. If possible can you share the pbix file where u have added the Revenue by city to Matrix visual on Rows. Thanks!
revised method:
To address your requirement in Power BI, you need to create a matrix that shows sales orders at an hourly basis based on the city and also shows the revenue per city. The key is to ensure that you have the right relationship between your fact and dimension tables and then use DAX measures to aggregate data appropriately.
Here's a step-by-step guide to help you achieve this:
Make sure your data model in Power BI has the following:
You mentioned that you've already created an hour column. If not, you can create a calculated column or measure to extract the hour from the OrderDateTime field.
Sales Orders = COUNTROWS('SalesOrderDetail')
Revenue = SUM('SalesOrderDetail'[NetSales])
Ensure that relationships between your tables are correctly set up. The relationship should be based on the City and the Hour column you've created or the OrderDateTime column.
If adding both Sales Orders and Revenue in the Values field of the matrix causes issues with aggregation, you can create a separate matrix or table visual for Revenue. Alternatively, ensure that there's no conflict in the way you've structured your DAX measures.
By following these steps and ensuring that your data model and DAX measures are correctly structured, you should be able to create a matrix that displays sales orders at an hourly basis based on the city and also shows the revenue per city.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
5 | |
5 | |
4 | |
4 | |
3 |