Forum Discussion
Develop matrix with colum on right
- Anonymous2 years ago
Hi Anonymous
Based on your description, you just need to update the calendar table to the following.
Calendar = ADDCOLUMNS(CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])),"Year-Month",FORMAT([Date],"YYYY-MM"))2.Change the type table to the following.
Type = var a=SUMMARIZE('Table',[Date]) var b={"Min","Max","Avg"} return UNION(a,b)3.Change the measure to the following.
Measure2 = VAR a = MAXX ( FILTER ( ALLSELECTED ( 'Table' ), [Cat] IN VALUES ( 'Table'[Cat] ) ), [Sample] ) VAR b = MINX ( FILTER ( ALLSELECTED ( 'Table' ), [Cat] IN VALUES ( 'Table'[Cat] ) ), [Sample] ) VAR c = AVERAGEX ( FILTER ( ALLSELECTED ( 'Table' ), [Cat] IN VALUES ( 'Table'[Cat] ) ), [Sample] ) RETURN SWITCH ( SELECTEDVALUE ( 'Type'[Type] ), "Avg", c, "Max", a, "Min", b, CALCULATE ( [Sample], FILTER ( 'Calendar', FORMAT ( [Date], "" ) IN VALUES ( 'Type'[Type] ) ) ) )Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Based on your description, you just need to update the calendar table to the following.
Calendar = ADDCOLUMNS(CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])),"Year-Month",FORMAT([Date],"YYYY-MM"))
2.Change the type table to the following.
Type = var a=SUMMARIZE('Table',[Date])
var b={"Min","Max","Avg"}
return UNION(a,b)
3.Change the measure to the following.
Measure2 =
VAR a =
MAXX (
FILTER ( ALLSELECTED ( 'Table' ), [Cat] IN VALUES ( 'Table'[Cat] ) ),
[Sample]
)
VAR b =
MINX (
FILTER ( ALLSELECTED ( 'Table' ), [Cat] IN VALUES ( 'Table'[Cat] ) ),
[Sample]
)
VAR c =
AVERAGEX (
FILTER ( ALLSELECTED ( 'Table' ), [Cat] IN VALUES ( 'Table'[Cat] ) ),
[Sample]
)
RETURN
SWITCH (
SELECTEDVALUE ( 'Type'[Type] ),
"Avg", c,
"Max", a,
"Min", b,
CALCULATE (
[Sample],
FILTER ( 'Calendar', FORMAT ( [Date], "" ) IN VALUES ( 'Type'[Type] ) )
)
)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous2 years agoNot applicable
last piece is how to can be setup ascending order or date and text in specific order non-alphabetical order for Min, max and Avg