Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
We play foosball at our company and play mostly adhoc games. I would like to determine two things:
I cannot figure out if this is possible or if I have to create another intermediary table to calculate this stuff... But some direction would be great.
Solved! Go to Solution.
Hi there,
Interesting problem
I had a play with this and here is a sample solution in a PBIX file with source spreadsheet.
https://www.dropbox.com/s/szg1uesipaxa15x/Foosey%20Greatest%20Ally%20and%20Nemesis.pbix?dl=0
https://www.dropbox.com/s/wodxj443py5xdk0/FooseyData.xlsx?dl=0
Seems to work but please test it out 🙂
I think this could be possibly modelled similarly to 'basket analysis' (http://www.daxpatterns.com/basket-analysis/) but I have not tried this.
Greatest Ally = // Note: Ties are broken by selecting the first Player alphabetically using FIRSTNONBLANK CALCULATE ( FIRSTNONBLANK ( Foosey[Player], 0 ), TOPN ( 1, CALCULATETABLE ( ADDCOLUMNS ( VALUES ( Foosey[Player] ), "Count", CALCULATE ( COUNTROWS ( Foosey ) ) ), SUMMARIZE ( Foosey, Foosey[Game], Foosey[Score] ), FILTER ( ALL ( Foosey[Player] ), NOT ( CONTAINS ( VALUES ( Foosey[Player] ), Foosey[Player], Foosey[Player] ) ) ), Foosey[Score] = 10 ), [Count] ) )
Nemesis = // Note: Ties are broken by selecting the first Player alphabetically using FIRSTNONBLANK CALCULATE ( FIRSTNONBLANK ( Foosey[Player], 0 ), TOPN ( 1, CALCULATETABLE ( ADDCOLUMNS ( VALUES ( Foosey[Player] ), "Count", CALCULATE ( COUNTROWS ( Foosey ) ) ), CALCULATETABLE ( VALUES ( Foosey[Game] ), Foosey[Score] = 5 ), FILTER ( ALL ( Foosey[Player] ), NOT ( CONTAINS ( VALUES ( Foosey[Player] ), Foosey[Player], Foosey[Player] ) ) ), Foosey[Score] = 10 ), [Count] ) )
Owen
If you have the data table on the left - what do you expects the results to be or to look like?
Something like the table on the right?
Not quite, I didn't explain very well. I would expect to get this:
Each of those names is calculated based on the amount of games you've won with the other person or based on the count of games you have lost against someone.
Hi there,
Interesting problem
I had a play with this and here is a sample solution in a PBIX file with source spreadsheet.
https://www.dropbox.com/s/szg1uesipaxa15x/Foosey%20Greatest%20Ally%20and%20Nemesis.pbix?dl=0
https://www.dropbox.com/s/wodxj443py5xdk0/FooseyData.xlsx?dl=0
Seems to work but please test it out 🙂
I think this could be possibly modelled similarly to 'basket analysis' (http://www.daxpatterns.com/basket-analysis/) but I have not tried this.
Greatest Ally = // Note: Ties are broken by selecting the first Player alphabetically using FIRSTNONBLANK CALCULATE ( FIRSTNONBLANK ( Foosey[Player], 0 ), TOPN ( 1, CALCULATETABLE ( ADDCOLUMNS ( VALUES ( Foosey[Player] ), "Count", CALCULATE ( COUNTROWS ( Foosey ) ) ), SUMMARIZE ( Foosey, Foosey[Game], Foosey[Score] ), FILTER ( ALL ( Foosey[Player] ), NOT ( CONTAINS ( VALUES ( Foosey[Player] ), Foosey[Player], Foosey[Player] ) ) ), Foosey[Score] = 10 ), [Count] ) )
Nemesis = // Note: Ties are broken by selecting the first Player alphabetically using FIRSTNONBLANK CALCULATE ( FIRSTNONBLANK ( Foosey[Player], 0 ), TOPN ( 1, CALCULATETABLE ( ADDCOLUMNS ( VALUES ( Foosey[Player] ), "Count", CALCULATE ( COUNTROWS ( Foosey ) ) ), CALCULATETABLE ( VALUES ( Foosey[Game] ), Foosey[Score] = 5 ), FILTER ( ALL ( Foosey[Player] ), NOT ( CONTAINS ( VALUES ( Foosey[Player] ), Foosey[Player], Foosey[Player] ) ) ), Foosey[Score] = 10 ), [Count] ) )
Owen
Glad it's working as intended 🙂
I forgot to mention that I wrote those measures to handle the Greatest Ally or Nemesis of a group as well as an individual.
However haven't tested that specifically.
e.g. If you select two people, at a total level, Greatest Ally should evaluate to the person who appears most often as the ally of either of the two people selected.
All the best,
Owen
This is fantastic! I would have never of thought to do it via a measure as opposed to a table. I plugged it in and it works great! Now it will take me the next week to go through and understand exactly what you did . Only one change was needed, a score of less than 10 indicates a loss, so I made that adjustment in the formula but other than that it does exactly what I need! I really appreciate the help!
So if you have the data table on the left - what do you expect the result to be? Something like the table on the right?
So if you have the data table on the left - what do you expect the result to be? Something like the table on the right?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |