Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi guys,
I need your help at creating a measure.
Two tables: Revenue and WorkingHours - they are NOT related. They have one connecting key which is the countryID.
Above picture shows the workinghours table.
The measure is very simple and looks like this:
Measure X =CALCULATE(SUMX ( 'Revenue'; [DRevenue] / [Cost] ) / SUMX(WorkingHours; [Hours]))
It works fine, but the worked hours table contains hours for different countries, which leads to the Measure X calculating things wrongly because the denominator (SUMX(WorkingHours; [Hours])) is summing all country values.
Sample data:
@umahm1 wrote:Hi guys,
I need your help at creating a measure.
Two tables: Revenue and WorkingHours - they are NOT related. They have one connecting key which is the countryID.
Above picture shows the workinghours table.
The measure is very simple and looks like this:
Measure X =CALCULATE(SUMX ( 'Revenue'; [DRevenue] / [Cost] ) / SUMX(WorkingHours; [Hours]))
It works fine, but the worked hours table contains hours for different countries, Audacity Find My iPhone Origin which leads to the Measure X calculating things wrongly because the denominator (SUMX(WorkingHours; [Hours])) is summing all country values.
Sample data:
As best practice it regards have nation measurement and connection these tables to that and after that your measure will work fine. You can make ths nation measurement from these table utilizing DAX or PowerQuery. Fill me in as to whether you require additionally help.
@umahm1 you are saying country id is in both the tables and you want to create measure whcih calculates for each country, correct?
As best practice it is good to have country dimension and link these tables to that and then your measure will work fine.
You can create ths country dimension from these table using DAX or PowerQuery. Let me know if you need further help.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@umahm1 since you already have dimension table and you understand star schema, it will be very easy if you bring Country table in your model and wok thru this.
Let's do simple measures and go from there, assuming you already have [Revenue], [Cost], [Hours] measures calculated.
Revenue / Cost = Divide( [Revenue], [Cost], 0 )
Now drop country from dimension country table and [Revenue/Cost] and [hours] measure, you will notice each measure will be calculated for that specific country.
Add Another measure
Measure X = Divide( [Revenue / Cost], [Hours], 0 )
And once you drop this measure in the table visual mentioned above, you will find your calculation are all correct.
Having said that, bringing country dimentsion and linking with "Revenue" and "Working Hours" table will simply the things and is best practice to achive what you are looking for.
Hope it is helpful.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@umahm1 it will do it for all the countries.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@umahm1 if you want only for UK, just filter on UK and it will work. Not fully sure what your exact requirements are.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@umahm1 the solution which I described earlier will work. Thanks
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@umahm1 you have to share the sample dataset.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.