Forum Discussion
mcam99
8 years agoFrequent Visitor
Add Column Group by
I have the following query to create groups where an entity exists in more than 1 group ie User 1, Mobile User 1, Desktop = User 1, Mobile,Desktop My issue is where I have a different pri...
- 8 years ago
Try this one
Attributes = ADDCOLUMNS ( GROUPBY ( Control, Control[UUID] ), "PrimaryGroup", CALCULATE ( CONCATENATEX ( VALUES ( Control[PrimaryGroup] ), Control[PrimaryGroup], ",", Control[PrimaryGroup] ), Control[IsFootfall] = 0 ), "SecondaryGroup", CALCULATE ( CONCATENATEX ( VALUES ( Control[SecondaryGroup] ), Control[SecondaryGroup], ",", Control[SecondaryGroup] ), Control[IsFootfall] = 0 ) )
Zubair_Muhammad
8 years agoCommunity Champion
Please Give this a shot
Attributes =
ADDCOLUMNS (
GROUPBY ( Control, Control[UUID] ),
"PrimaryGroup", CALCULATE (
CONCATENATEX ( VALUES ( Control[PrimaryGroup] ), Control[PrimaryGroup], "," ),
Control[IsFootfall] = 0
),
"SecondaryGroup", CALCULATE (
CONCATENATEX (
VALUES ( Control[SecondaryGroup] ),
Control[SecondaryGroup],
","
),
Control[IsFootfall] = 0
)
)mcam99
8 years agoFrequent Visitor
Thanks Zubair that is really useful, it has grouped most of them - although its still not grouping I would expect.
these are my results
Desktop
"Desktop,Mobile"
Facebook
"Facebook,Desktop"
"Facebook,Desktop,Mobile"
"Facebook,Mobile"
"Facebook,Mobile,Desktop"
Mobile
"Mobile,Desktop"
- Zubair_Muhammad8 years agoCommunity Champion
Try this one
Attributes = ADDCOLUMNS ( GROUPBY ( Control, Control[UUID] ), "PrimaryGroup", CALCULATE ( CONCATENATEX ( VALUES ( Control[PrimaryGroup] ), Control[PrimaryGroup], ",", Control[PrimaryGroup] ), Control[IsFootfall] = 0 ), "SecondaryGroup", CALCULATE ( CONCATENATEX ( VALUES ( Control[SecondaryGroup] ), Control[SecondaryGroup], ",", Control[SecondaryGroup] ), Control[IsFootfall] = 0 ) )- mcam998 years agoFrequent Visitor
Thats awesome, thank you!