Forum Discussion
sumx question
this is the definition of sumx -
Returns the sum of an expression evaluated for each row in a table.
seems like it's not the sum of an expression-
what the PBI does is sum(UsersCount)\2
- Phil_Seamark9 years ago
Microsoft Employee
Hi there,
Any chance you can post the sample set of data that makes this up. As well as the code you are using to build your [Target] measure.
Cheers,
- MP_1239 years ago
Microsoft Employee
thank you Phil_Seamark!
this is my data
what I want to get is avg per week, so for 'User Location_Main' - it will be (158612+155831)\2 (=distinct count of target date)
and for the first, it will be just divided by 1.
what I want to get is the sum of this two averages. power BI divided the total sum by 2 and it's wrong
- Phil_Seamark9 years ago
Microsoft Employee
Would you consider a DAX calulated table as a solution?
Something along these lines? You can then simply SUM the [WeeklySumAVGPerWeek] column
New Table = SUMMARIZECOLUMNS( 'AggregatedWeeklyNewCoverageAllExpsView'[Inference Name], "Weekly Sum Pre" , SUM(AggregatedWeeklyNewCoverageAllExpsView[WeeklySumPre]), "Count of Target Date" , DISTINCTCOUNT(AggregatedWeeklyNewCoverageAllExpsView[TargetDate]), "WeeklySumAVGPerWeek" , DIVIDE(SUM(AggregatedWeeklyNewCoverageAllExpsView[WeeklySumPre]), DISTINCTCOUNT(AggregatedWeeklyNewCoverageAllExpsView[TargetDate])) )