Forum Discussion
Return value from column
- 6 years ago
Hi Anonymous ,
We think the matrix visual should meet your requirement.
In case you need a calculated table, you can use the following formula ( Consider of the length, I just put part of them)
NewTable = VAR montht = ADDCOLUMNS ( DISTINCT ( 'Table'[Month] ), "index", RANKX ( DISTINCT ( 'Table'[Month] ), [Month],, ASC ) ) VAR resultt = ADDCOLUMNS ( DISTINCT ( SELECTCOLUMNS ( 'Table', "IDCtmr", [IDCtmr], "State", [State], "Company", [Company] ) ), "Mont_M1", MAXX ( FILTER ( montht, [index] = 1 ), [Month] ), "SaleType _M1", MAXX ( FILTER ( 'Table', 'Table'[Month] = MAXX ( FILTER ( montht, [index] = 1 ), [Month] ) ), [SaleType] ), "Volume_M1", SUMX ( FILTER ( 'Table', 'Table'[Month] = MAXX ( FILTER ( montht, [index] = 1 ), [Month] ) ), [Volume] ), "Mont_M2", MAXX ( FILTER ( montht, [index] = 2 ), [Month] ), "SaleType _M2", MAXX ( FILTER ( 'Table', 'Table'[Month] = MAXX ( FILTER ( montht, [index] = 2 ), [Month] ) ), [SaleType] ), "Volume_M2", SUMX ( FILTER ( 'Table', 'Table'[Month] = MAXX ( FILTER ( montht, [index] = 2 ), [Month] ) ), [Volume] )
ADD MORE MONTH HERE ) RETURN resulttBut it need to add cord for every month, so does the measure or calculated column.
BTW, pbix as attached.
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
We think the matrix visual should meet your requirement.
In case you need a calculated table, you can use the following formula ( Consider of the length, I just put part of them)
NewTable =
VAR montht =
ADDCOLUMNS (
DISTINCT ( 'Table'[Month] ),
"index", RANKX ( DISTINCT ( 'Table'[Month] ), [Month],, ASC )
)
VAR resultt =
ADDCOLUMNS (
DISTINCT (
SELECTCOLUMNS (
'Table',
"IDCtmr", [IDCtmr],
"State", [State],
"Company", [Company]
)
),
"Mont_M1", MAXX ( FILTER ( montht, [index] = 1 ), [Month] ),
"SaleType _M1", MAXX (
FILTER (
'Table',
'Table'[Month]
= MAXX ( FILTER ( montht, [index] = 1 ), [Month] )
),
[SaleType]
),
"Volume_M1", SUMX (
FILTER (
'Table',
'Table'[Month]
= MAXX ( FILTER ( montht, [index] = 1 ), [Month] )
),
[Volume]
),
"Mont_M2", MAXX ( FILTER ( montht, [index] = 2 ), [Month] ),
"SaleType _M2", MAXX (
FILTER (
'Table',
'Table'[Month]
= MAXX ( FILTER ( montht, [index] = 2 ), [Month] )
),
[SaleType]
),
"Volume_M2", SUMX (
FILTER (
'Table',
'Table'[Month]
= MAXX ( FILTER ( montht, [index] = 2 ), [Month] )
),
[Volume]
)
ADD MORE MONTH HERE
)
RETURN
resultt
But it need to add cord for every month, so does the measure or calculated column.
BTW, pbix as attached.
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.