Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello Everyone,
I have two tables that look as so:
So each taskID has a goal, for instance the taskID ending in 9910 has a goal of 8. However, if I count the number of ids assigned to the taskID 9910 it is 12, but the goal is 8. I'd like to create a measure that counts the ids assigned to a taskID UP TO the respective goal for each taskID. Then I'd like to add up all of the ones that are assigned and compare it to the total goal of 34 in this case.
For instance, there could be 80 ids in total assigned to the taskIDs which have a total goal or limit of 34. However, if for a certain taskID there are 5 assigned when the goal is 6, then the cumulative assigned is 33, not 79. Basically, the cumulative total of ids assigned should not be higher than set goal (34 in this case), and each taskID is has a separate goal (8 in this case).
Thank you, and let me know if this post needs further clarification.
Solved! Go to Solution.
Hi @gcv1999 ,
You could refer to the following measures. "Table1" is your fact table, "Table2" is your goal table.
count =
VAR a =
DISTINCTCOUNT ( 'Table1'[id] )
VAR b =
LOOKUPVALUE (
'Table2'[goal],
'Table2'[taskID], SELECTEDVALUE ( 'Table1'[taskID] )
)
RETURN
IF ( a >= b, b, a )
sum =
SUMX ('Table2', [count] )
Here is the result.
Hi @gcv1999 ,
Refer to the following measures.
count =
DISTINCTCOUNT('Table'[id])
sum =
SUMX ( ALLEXCEPT ( 'Table', 'Table'[taskID] ), [count] )
Here is the result, but it is different with your online tables.
@v-eachen-msft I understand the formulas that you used, but what I am trying to do is compare the total number of taskIDs to the goal of each taskID. For instance, the 12 you got from totaling the taskID 9910 should be compared to its respective taskID in the second table. In this case the 12 should be compared to the 8, and since it is equal to or greater than 8, it should return 8. I am trying to find a measure that will do this for each taskID, so that the total is less than or equal to the total goal of 34.
Hi @gcv1999 ,
You could refer to the following measures. "Table1" is your fact table, "Table2" is your goal table.
count =
VAR a =
DISTINCTCOUNT ( 'Table1'[id] )
VAR b =
LOOKUPVALUE (
'Table2'[goal],
'Table2'[taskID], SELECTEDVALUE ( 'Table1'[taskID] )
)
RETURN
IF ( a >= b, b, a )
sum =
SUMX ('Table2', [count] )
Here is the result.
@gcv1999 I would recommend to put a sample excel file with sample data and calculations, it will help a lot.
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.
@parry2k I am working with a database directly, but I tried to put the data into a google doc for you to view. Hopefully this makes things clearer: Spreadsheet Link
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |