Forum Discussion
Problems with COUNT
Hi elandry9840
how does your report look like? Can you share a screenshot of your data model?
- elandry98404 years agoFrequent Visitor
Sure thing! Thanks for the reply!!
Not sure if this will be big enough. If not, let me know.
- elandry98404 years agoFrequent Visitor
This is better:
- elandry98404 years agoFrequent Visitor
Best:
- tamerj14 years agoCommunity Champion
The screenshot is very small. However please try
Number of Stocks < 200Day MA =
VAR FortyWeekMA = [40-week MA]
RETURN
COUNTROWS ( FILTER ( 'PriceTable', PriceTable[closeadj] < FortyWeekMA ) )- tamerj14 years agoCommunity Champion
Have you tried above code?
- Anonymous4 years agoNot applicable
Hi elandry9840 ,
Not sure, is the first measure wrong?
Please use this measure and test.40-week MA = CALCULATE ( AVERAGE ( PriceTable[closeadj] ), FILTER ( 'Calendar', 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) && 'Calendar'[Date] >= MAX ( 'Calendar'[Date] ) - 200 ) )Attached PBIX file for reference.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!
- elandry98404 years agoFrequent Visitor
Hi v-cgao-msft,
Appreciate the reply!! I'm not sure it's working tho. Take a look:
40-week MA (New) =CALCULATE (AVERAGE ( PriceTable[closeadj] ),FILTER ('Calendar','Calendar'[Date] <= MAX ( 'Calendar'[Date] )&& 'Calendar'[Date]>= MAX ( 'Calendar'[Date] ) - 200))40-week MA =AVERAGEX(DATESBETWEEN('Calendar'[Date], max('Calendar'[Date]) - 200, max('Calendar'[Date])),calculate(sum(PriceTable[closeadj])))Looks like [40-Wk MA (New)] is returning the closeadj. See below:Could it have something to do with the price table having data only once per week? I noticed your price table had dailt prices.
Thanks again!