topic Re: DAX formula for percentage of time a value appears for each name in Desktop
https://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506611#M622701
<P>Hi, thanks for the quick response. I tried using the formula you have stated but it doesn't seem to work. Maybe it's because my data has more names and dates? (I have thousands of rows). Any possible reason as to why this formula will not work for my data?</P>Fri, 20 Nov 2020 07:41:49 GMT7ea8ea2020-11-20T07:41:49ZDAX formula for percentage of time a value appears for each name
https://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506551#M622683
<P>Hi All,</P><P> </P><P>I have a data set that looks something like this:</P><TABLE border="1"><TBODY><TR><TD>Date</TD><TD>Name</TD><TD>T or F</TD></TR><TR><TD>18/11/2020</TD><TD>A</TD><TD>T</TD></TR><TR><TD>18/11/2020</TD><TD>B</TD><TD>T</TD></TR><TR><TD>19/11/2020</TD><TD>A</TD><TD>T</TD></TR><TR><TD>19/11/2020</TD><TD>B</TD><TD>F</TD></TR></TBODY></TABLE><P><BR />How should I go about writing a DAX formula if I want to know the percentage of times there is T for a certain name. For example, I would like to write a measure for A which equals 100%, and a measure for B which is 50%. Any help would be appreciated. Thanks</P><P> </P><P> </P>Fri, 20 Nov 2020 07:15:12 GMThttps://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506551#M6226837ea8ea2020-11-20T07:15:12ZRe: DAX formula for percentage of time a value appears for each name
https://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506561#M622686
<P><LI-USER uid="264170"></LI-USER> , Try measures for </P>
<P>A</P>
<P>calculate( divide(countx(filter(table, table[T of F] ="T"), Table[Date]), countx(Table, Table[Date])) , Table[Name] ="A")</P>
<P> </P>
<P>or</P>
<P><BR />calculate( divide(countx(filter(table, table[T of F] ="T"), Table[Date]), countx(allselected(Table), Table[Date])), Table[Name] ="A")</P>
<P> </P>
<P>for B</P>
<P>calculate( divide(countx(filter(table, table[T of F] ="T"), Table[Date]), countx(Table, Table[Date])) , Table[Name] ="B")</P>
<P> </P>
<P>or</P>
<P><BR />calculate( divide(countx(filter(table, table[T of F] ="T"), Table[Date]), countx(allselected(Table), Table[Date])), Table[Name] ="B")</P>Fri, 20 Nov 2020 07:19:07 GMThttps://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506561#M622686amitchandak2020-11-20T07:19:07ZRe: DAX formula for percentage of time a value appears for each name
https://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506611#M622701
<P>Hi, thanks for the quick response. I tried using the formula you have stated but it doesn't seem to work. Maybe it's because my data has more names and dates? (I have thousands of rows). Any possible reason as to why this formula will not work for my data?</P>Fri, 20 Nov 2020 07:41:49 GMThttps://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1506611#M6227017ea8ea2020-11-20T07:41:49ZRe: DAX formula for percentage of time a value appears for each name
https://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1512944#M624331
<P>Hi, <LI-USER uid="264170"></LI-USER> </P>
<P>You can try measure as below:</P>
<LI-CODE lang="markup">Count_T =
VAR a =
COUNTX ( FILTER ( 'Table', 'Table'[T or F] = "T" ), 'Table'[Date] )
RETURN
IF ( ISBLANK ( a ), 0, a )</LI-CODE><LI-CODE lang="markup">Count = COUNTX('Table', 'Table'[Date])</LI-CODE><LI-CODE lang="markup">Percentage% = [Count_T]/[Count]</LI-CODE>
<P>Check sample file for more details.</P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="32.png" style="width: 999px;"><img src="https://community.powerbi.com/t5/image/serverpage/image-id/403215iD69E0D2EF5C9AE4E/image-size/large?v=v2&px=999" role="button" title="32.png" alt="32.png" /></span></P>
<P>Best Regards,<BR />Community Support Team _ Eason<BR /><BR /></P>Tue, 24 Nov 2020 08:09:36 GMThttps://community.powerbi.com/t5/Desktop/DAX-formula-for-percentage-of-time-a-value-appears-for-each-name/m-p/1512944#M624331v-easonf-msft2020-11-24T08:09:36Z