Forum Discussion
deb_power123
Helper V
4 years agoDAX query to create DAX table with average values per month against category
Hi All, I have the below input source table with Audit Date,Score,SchoolName and PercentageStudents columns and table name as Table. I need to find the average of score and percentageStudents pe...
wdx223_Daniel
Community Champion
4 years agoNewTable=GENERATE(
NewTable =
GENERATE (
SUMMARIZE (
SELECTCOLUMNS (
'Table',
"CurrentMonth", FORMAT ( 'Table'[AuditDate], "MMMM - yyyy" )
),
[CurrentMonth]
),
ADDCOLUMNS (
DATATABLE (
"Category", STRING,
{
{ "AverageScore" },
{ "AveragePercentage" }
}
),
"ParamScore",
VAR _m = [CurrentMonth]
RETURN
IF (
[Category] = "AverageScore",
FORMAT (
CALCULATE (
AVERAGE ( 'Table'[Score] ),
FORMAT ( 'Table'[AuditDate], "MMMM - yyyy" ) = _m
),
""
),
FORMAT (
CALCULATE (
AVERAGE ( 'Table'[PercentageStudents] ),
FORMAT ( 'Table'[AuditDate], "MMMM - yyyy" ) = _m
),
"0%"
)
)
)
)
deb_power123
Helper V
4 years agoHi wdx223_Daniel This is exactly I was looking for , thankyou for letting me know the approach.I treid to implement is and it worked.Thanks a ton.