<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Golf Stats Analysis - Countif and other such formulas in PowerBI in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Golf-Stats-Analysis-Countif-and-other-such-formulas-in-PowerBI/m-p/3440925#M157619</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am hoping to conduct some analysis on my golf game. I am somewhat new to PowerBI, and much more comfortable working with excel formulas.&lt;/P&gt;&lt;P&gt;I am collecting data from a MS Form which is then linked to PowerBI via PowerAutomate, if that gives you any insight into the format of the data. Currently the dummy data only accounts for Holes 1 &amp;amp; 2, eventually that will be extended out to the full 18 holes – I will make the changes to the formulas as appropriate then.&lt;/P&gt;&lt;P&gt;Attached is a excel screenshot of roughly the data analysis I would like to achieve (look below). The cells in green I have figured out however I am stuck on the remainder.&lt;/P&gt;&lt;P&gt;I am happy to share the pbix file as required (I dont know how here). This is the excel download of the MS FORM data.&lt;/P&gt;&lt;P&gt;&lt;A href="https://vicgov-my.sharepoint.com/:x:/r/personal/adrian_murray_agriculture_vic_gov_au/Documents/Golf%20Stats(1-8).xlsx?d=wfcb6b594660b43ba91c6a7ddda7bf4d2&amp;amp;csf=1&amp;amp;web=1&amp;amp;e=QyroTK" target="_self"&gt;Golf Stats - Excel spreadsheet&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone could help with any parts of this it would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Fairways hit with each club type (driver, 3 wood etc).&lt;/U&gt;&lt;/STRONG&gt; i.e. If the DRIVER was used, did it hit the fairway – example shows 11 times used, 7 fairways hit or 64% success rate. In excel I would normally go down the route of a COUNTIFS formula.&lt;OL&gt;&lt;LI&gt;I was using last N on filters to get the most recent round. Therefore with the filter removed I expect I should be able to get historical figures.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Greens in Regulation (GIR).&lt;/U&gt;&lt;/STRONG&gt; The data received will show a “yes” or “No” for each hole if a GIR was successful or not. I have a formula working for that one as shown. I want to know my conversion rate of a FAIRWAY drive into a GIR success. I expect this will be a similar formula to the above (i.e. a COUNTIF). If HOLE 1 = FAIRWAY and GIR then count 1. If HOLE 2 = FAIRWAY and NOT GIR then count 0.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# of GIR =

var _rows = {[Hole 1 - Green in Regulation], [Hole 2 - Green in Regulation]}

var _count =

    COUNTROWS( FILTER( _rows, [Value] = "No" ) )

RETURN

    IF( _count &amp;gt;0, _count, 0 )​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;3. Putting&lt;/STRONG&gt; – The data will have a total of 4 columns for each hole, if I have 2 putts on that hole, two columns will have data, 3 putts 3 columns and so on. The data collected is a distance or number type of data, 0.5, 0.9, 4.2 etc. I did read somewhere that an additional table would be required to set the desired ranges “putting ranges”. Not sure if that’s correct.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;How many putts attempted at distance range? &lt;/U&gt;&lt;/STRONG&gt;Using the numbers above, the answer for Putts 0 – 1m range would be 2 (0.5 &amp;amp; 0.9). How do lookup all putts for each hole and count the number of times an attempt was made at the distance range?&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Putts made at distance.&lt;/U&gt; &lt;/STRONG&gt;(This one is way to hard for me!). NOTE: If column Hole 2 – Putt 3 (Distance) does not contain a value, then the putt was made on putt 2 (as shown below).&lt;/LI&gt;&lt;/OL&gt;&lt;OL&gt;&lt;LI&gt;Either, requires looking for the column “Hole 1 – Total Putts”, say equals 2, then find the corresponding column, “Hole 1 – Putt 2 (Distance)”, and if within the range 0 – 1m, then count 1. Then repeat for each hole. OR&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Find the maximum of “Hole 1 – Putt ? (Distance)” columns that contains data. And determine if value fits within range.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Example below shows 2 rounds of golf. If the range to be calculated was 0 – 2m distance, then the count for round 1 would be 0, and round 2 would be 1.&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;OL&gt;&lt;LI&gt;&lt;U&gt;&lt;STRONG&gt;% Today&lt;/STRONG&gt;&amp;nbsp;&lt;/U&gt;– should be an easy calculation of “putts made @distance” / “putt attempts@ distance).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Approach Shots&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Count of Shots at Distance&lt;/U&gt;&lt;/STRONG&gt; – should be similar to putting distances?? How many shots were taken from within the range specified?&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Proximity to Hole (average distance today).&lt;/U&gt;&lt;/STRONG&gt; This is the result of the shot taken.&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;If the data was as follows. Then the answer for the range 126 – 150m would be 7.5m (10 + 5 /2 = 7.5).&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Hole 1 - Approach Shot (dist)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole 1 - Approach Shot (prox to hole)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole 2 - Approach Shot (dist)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole 2 - Approach Shot (prox to hole)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;135&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;145&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Prox to Hole (average distance history). &lt;/U&gt;&lt;/STRONG&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Across all rounds from a certain distance range, what is the average distance from the hole after the shot is taken?&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Min and Max (Distance)&lt;/U&gt;&lt;/STRONG&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Of all the shots from the distance range on that day, what was the closest/furthest from the hole (result after approach shot made).&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DESIRED DATA OUTPUTS&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 05:17:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-09-21T05:17:28Z</dc:date>
    <item>
      <title>Golf Stats Analysis - Countif and other such formulas in PowerBI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Golf-Stats-Analysis-Countif-and-other-such-formulas-in-PowerBI/m-p/3440925#M157619</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am hoping to conduct some analysis on my golf game. I am somewhat new to PowerBI, and much more comfortable working with excel formulas.&lt;/P&gt;&lt;P&gt;I am collecting data from a MS Form which is then linked to PowerBI via PowerAutomate, if that gives you any insight into the format of the data. Currently the dummy data only accounts for Holes 1 &amp;amp; 2, eventually that will be extended out to the full 18 holes – I will make the changes to the formulas as appropriate then.&lt;/P&gt;&lt;P&gt;Attached is a excel screenshot of roughly the data analysis I would like to achieve (look below). The cells in green I have figured out however I am stuck on the remainder.&lt;/P&gt;&lt;P&gt;I am happy to share the pbix file as required (I dont know how here). This is the excel download of the MS FORM data.&lt;/P&gt;&lt;P&gt;&lt;A href="https://vicgov-my.sharepoint.com/:x:/r/personal/adrian_murray_agriculture_vic_gov_au/Documents/Golf%20Stats(1-8).xlsx?d=wfcb6b594660b43ba91c6a7ddda7bf4d2&amp;amp;csf=1&amp;amp;web=1&amp;amp;e=QyroTK" target="_self"&gt;Golf Stats - Excel spreadsheet&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone could help with any parts of this it would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Fairways hit with each club type (driver, 3 wood etc).&lt;/U&gt;&lt;/STRONG&gt; i.e. If the DRIVER was used, did it hit the fairway – example shows 11 times used, 7 fairways hit or 64% success rate. In excel I would normally go down the route of a COUNTIFS formula.&lt;OL&gt;&lt;LI&gt;I was using last N on filters to get the most recent round. Therefore with the filter removed I expect I should be able to get historical figures.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Greens in Regulation (GIR).&lt;/U&gt;&lt;/STRONG&gt; The data received will show a “yes” or “No” for each hole if a GIR was successful or not. I have a formula working for that one as shown. I want to know my conversion rate of a FAIRWAY drive into a GIR success. I expect this will be a similar formula to the above (i.e. a COUNTIF). If HOLE 1 = FAIRWAY and GIR then count 1. If HOLE 2 = FAIRWAY and NOT GIR then count 0.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# of GIR =

var _rows = {[Hole 1 - Green in Regulation], [Hole 2 - Green in Regulation]}

var _count =

    COUNTROWS( FILTER( _rows, [Value] = "No" ) )

RETURN

    IF( _count &amp;gt;0, _count, 0 )​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;3. Putting&lt;/STRONG&gt; – The data will have a total of 4 columns for each hole, if I have 2 putts on that hole, two columns will have data, 3 putts 3 columns and so on. The data collected is a distance or number type of data, 0.5, 0.9, 4.2 etc. I did read somewhere that an additional table would be required to set the desired ranges “putting ranges”. Not sure if that’s correct.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;How many putts attempted at distance range? &lt;/U&gt;&lt;/STRONG&gt;Using the numbers above, the answer for Putts 0 – 1m range would be 2 (0.5 &amp;amp; 0.9). How do lookup all putts for each hole and count the number of times an attempt was made at the distance range?&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Putts made at distance.&lt;/U&gt; &lt;/STRONG&gt;(This one is way to hard for me!). NOTE: If column Hole 2 – Putt 3 (Distance) does not contain a value, then the putt was made on putt 2 (as shown below).&lt;/LI&gt;&lt;/OL&gt;&lt;OL&gt;&lt;LI&gt;Either, requires looking for the column “Hole 1 – Total Putts”, say equals 2, then find the corresponding column, “Hole 1 – Putt 2 (Distance)”, and if within the range 0 – 1m, then count 1. Then repeat for each hole. OR&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Find the maximum of “Hole 1 – Putt ? (Distance)” columns that contains data. And determine if value fits within range.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Example below shows 2 rounds of golf. If the range to be calculated was 0 – 2m distance, then the count for round 1 would be 0, and round 2 would be 1.&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;OL&gt;&lt;LI&gt;&lt;U&gt;&lt;STRONG&gt;% Today&lt;/STRONG&gt;&amp;nbsp;&lt;/U&gt;– should be an easy calculation of “putts made @distance” / “putt attempts@ distance).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Approach Shots&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Count of Shots at Distance&lt;/U&gt;&lt;/STRONG&gt; – should be similar to putting distances?? How many shots were taken from within the range specified?&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Proximity to Hole (average distance today).&lt;/U&gt;&lt;/STRONG&gt; This is the result of the shot taken.&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;If the data was as follows. Then the answer for the range 126 – 150m would be 7.5m (10 + 5 /2 = 7.5).&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Hole 1 - Approach Shot (dist)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole 1 - Approach Shot (prox to hole)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole 2 - Approach Shot (dist)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole 2 - Approach Shot (prox to hole)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;135&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;145&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Prox to Hole (average distance history). &lt;/U&gt;&lt;/STRONG&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Across all rounds from a certain distance range, what is the average distance from the hole after the shot is taken?&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Min and Max (Distance)&lt;/U&gt;&lt;/STRONG&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Of all the shots from the distance range on that day, what was the closest/furthest from the hole (result after approach shot made).&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DESIRED DATA OUTPUTS&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 05:17:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Golf-Stats-Analysis-Countif-and-other-such-formulas-in-PowerBI/m-p/3440925#M157619</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-21T05:17:28Z</dc:date>
    </item>
  </channel>
</rss>

