Forum Discussion
Advanced Grouping in unstructered set - StringAggregation
Hi fellow BI-enthusiastics,
I'm struggeling with a complex issue and hopefully someone can help me out.
I'm trying to create groups based on a unstructed set that have some self defined events.
Definition of event =
If Index-1 or Index-2 has a value then it's an event and
if Index+1 or Index+2 has a value then it's an event.
Basically I want to scan and group the indexes together to make an Unique event. Hopefully the screenshot explains what I need
I have came up with the following DAX, but that doesn't quite give me the results I need.
IF([EXCEEDED_LIMIT]<>BLANK();
CALCULATE(CONCATENATEX(Tabel1;[Index];"|";[Index];ASC);
FILTER(Tabel1;
Tabel1[Index]>=EARLIER(Tabel1[Index])-1 &&
Tabel1[Index]<=EARLIER(Tabel1[Index])+1)
))
Hopefully someone posses' more skills then I do and can help me out. This would be highly appreciated!!
Sample file is here : Table1.xlsx
Hi Nico,
one solution could be to use (various) custom columns to get to unique identifiers.I have for testing purposes now split it into several columns, but most probably can be done in much more condensed way.
1) Group Ind
Group Ind =VAR PreviousRow =TOPN (1;FILTER (Blad1;Blad1[index] < EARLIER ( Blad1[index] ));[index]; DESC)VAR PreviousIndex =MINX ( PreviousRow; [index] )VAR PreviousExceeded =MINX ( PreviousRow; [exceeded_limit])RETURNIF(OR(AND(Blad1[exceeded_limit]<>BLANK();PreviousExceeded=BLANK());AND(Blad1[exceeded_limit]<>BLANK();PreviousExceeded<>BLANK()));1;0)2) New Group IndNew Group Ind =VAR PreviousRow =TOPN (1;FILTER (Blad1;Blad1[index] < EARLIER ( Blad1[index] ));[index]; DESC)VAR PreviousGroupInd =MINX ( PreviousRow; [Group Ind] )RETURNIF(AND(Blad1[Group Ind]=1;PreviousGroupInd=0);"Ja";"Nee")3) Group NumberGroup Number =10000+CALCULATE(COUNT(Blad1[New Group Ind]);FILTER(Blad1;Blad1[New Group Ind]="Ja");FILTER (Blad1;Blad1[index] <= EARLIER ( Blad1[index] )))4) Event IndexEvent Index = IF(Blad1[Group Ind]=1;Blad1[Group Number];Blad1[index])Hope this helps
BR
Jeroen Heerschop
Get Responsive
4 Replies
- IceyCommunity Support
- BI-GeniuzAdvocate I
Hi Icey,
thanks for helping out this far! highy appreciated and it's a tough one indeed :P
Update:
I also got the flagging code wrapped in here. Maybe that helps a little bit?var Index1 = LOOKUPVALUE([EXCEEDED_LIMIT];[Index];[Index]+1) var Index2 = LOOKUPVALUE([EXCEEDED_LIMIT];[Index];[Index]-1) return IF([EXCEEDED_LIMIT]<>BLANK();1; IF([EXCEEDED_LIMIT]=BLANK(); IF(Index1<>BLANK() && Index2<>BLANK();1;BLANK())))- GetResponsiveRegular Visitor
Hi Nico,
one solution could be to use (various) custom columns to get to unique identifiers.I have for testing purposes now split it into several columns, but most probably can be done in much more condensed way.
1) Group Ind
Group Ind =VAR PreviousRow =TOPN (1;FILTER (Blad1;Blad1[index] < EARLIER ( Blad1[index] ));[index]; DESC)VAR PreviousIndex =MINX ( PreviousRow; [index] )VAR PreviousExceeded =MINX ( PreviousRow; [exceeded_limit])RETURNIF(OR(AND(Blad1[exceeded_limit]<>BLANK();PreviousExceeded=BLANK());AND(Blad1[exceeded_limit]<>BLANK();PreviousExceeded<>BLANK()));1;0)2) New Group IndNew Group Ind =VAR PreviousRow =TOPN (1;FILTER (Blad1;Blad1[index] < EARLIER ( Blad1[index] ));[index]; DESC)VAR PreviousGroupInd =MINX ( PreviousRow; [Group Ind] )RETURNIF(AND(Blad1[Group Ind]=1;PreviousGroupInd=0);"Ja";"Nee")3) Group NumberGroup Number =10000+CALCULATE(COUNT(Blad1[New Group Ind]);FILTER(Blad1;Blad1[New Group Ind]="Ja");FILTER (Blad1;Blad1[index] <= EARLIER ( Blad1[index] )))4) Event IndexEvent Index = IF(Blad1[Group Ind]=1;Blad1[Group Number];Blad1[index])Hope this helps
BR
Jeroen Heerschop
Get Responsive