To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I have two tables that follow this structure:
Response Table
Year | Month | Type | Year-Month-Type |
2022 | 01 | A | 2022-01-A |
2022 | 01 | A | 2022-01-A |
2022 | 01 | B | 2022-01-B |
2022 | 02 | A | 2022-02-A |
2022 | 02 | C | 2022-02-C |
Objective Table
Year-Month-Type | Objective |
2022-01-A | 4 |
2022-01-B | 1 |
2022-01-C | 6 |
2022-02-A | 3 |
2022-02-B | 2 |
2022-02-C | 5 |
Each Type of response has a different objective number for each year and each month.
I already created a relationship between the Year-Month-Type columns in both tables. I want to create a measure that divides:
Count of rows from the Response Table by the objective for that year, month and Type (Objective Table):
So, based on the example tables above, the measure should show the following values :
Year 2022
Month 1 -> Type A -> (rows in the response table) / (objective for that year-month-type) = 2/4 = 50%
Month 1 -> Type B -> (rows in the response table) / (objective for that year-month-type) = 1/1 = 100%
Month 1 -> Type C -> (rows in the response table) / (objective for that year-month-type) = 0/6 = 0%
Month 2 -> Type A -> (rows in the response table) / (objective for that year-month-type) = 1/3 = 33,33%
Month 2 -> Type B -> (rows in the response table) / (objective for that year-month-type) = 1/2 = 50%
Month 2 -> Type C -> (rows in the response table) / (objective for that year-month-type) = 0/5 = 0%
Can someone help mep?
@Anonymous add a measure:
% =
DIVIDE(
COUNTROWS ( ResponseTable ),
MAX ( ObjectiveTable[Objective] )
)
In a visual, use Year-Month-Type from the objective table and above measure and that will do it.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
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.