Forum Discussion
cosminc
Post Partisan
7 years agoInsert custom rows
Hi all, is it posible to add rows in a base like this: ID Year Month Client Label Value concatenate ID&Client 1 2018 1 cosmin A 1 1cosmin 1 2018 1 cosmin B 1 1cosmin ...
- 7 years ago
Hi COSMINC,
You could try to new custom row table by DAX like below
custom rows = SUMMARIZE ( cutsom, cutsom[ID], cutsom[Year], cutsom[Month], cutsom[client], cutsom[concatenate ID&Client], "value", IF ( CALCULATE ( SUM ( cutsom[Value] ), FILTER ( ALLEXCEPT ( cutsom, cutsom[ID] ), cutsom[Label] = "C" || cutsom[Label] = "D" ) ) = 2, 1, 0 ), "Label", "Z" )Then use selectcolumn and union syntax to combine two table like below
Table 2 = UNION ( cutsom, SELECTCOLUMNS ( 'custom rows', "id", 'custom rows'[ID], "year", 'custom rows'[Year], "Month", 'custom rows'[Month], "client", 'custom rows'[client], "lable", 'custom rows'[Label], "value", 'custom rows'[value], "con", 'custom rows'[concatenate ID&Client] ) )Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dax
Community Support
7 years agoHi COSMINC,
You could try to new custom row table by DAX like below
custom rows =
SUMMARIZE (
cutsom,
cutsom[ID],
cutsom[Year],
cutsom[Month],
cutsom[client],
cutsom[concatenate ID&Client],
"value", IF (
CALCULATE (
SUM ( cutsom[Value] ),
FILTER (
ALLEXCEPT ( cutsom, cutsom[ID] ),
cutsom[Label] = "C"
|| cutsom[Label] = "D"
)
) = 2,
1,
0
),
"Label", "Z"
)Then use selectcolumn and union syntax to combine two table like below
Table 2 =
UNION (
cutsom,
SELECTCOLUMNS (
'custom rows',
"id", 'custom rows'[ID],
"year", 'custom rows'[Year],
"Month", 'custom rows'[Month],
"client", 'custom rows'[client],
"lable", 'custom rows'[Label],
"value", 'custom rows'[value],
"con", 'custom rows'[concatenate ID&Client]
)
)Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cosminc
Post Partisan
7 years agoThanks,
very very helpfull!
Cosmin