Forum Discussion
Anonymous
7 years agoNot applicable
Identifying relevant local markets
Hi, I'm working for a company that define the local market of a branch/shop as all local authorities that represent at least 80% of customers. For the below examples: 1. if a branch has one ...
- 7 years ago
Hi Anonymous ,
One sample for your reference. Here I created two calculated columns to work on it. Please notice I modified your data a bit to make the logic more reasonable.
INT = VAR total = CALCULATE ( SUM ( [%of customers] ), FILTER ( Table1, Table1[Branch Number] = EARLIER ( Table1[Branch Number] ) && Table1[Local AN] <= EARLIER ( Table1[Local AN] ) ) ) VAR no = INT ( total * 10 ) RETURN noResult = VAR cou = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( Table1, Table1[Branch Number] = EARLIER ( Table1[Branch Number] ) && Table1[Local AN] <= EARLIER ( Table1[Local AN] ) && Table1[INT] = 8 ) ) RETURN IF ( Table1[INT] <= 8 && cou <> 2, 1, 0 )Pbix as attached.
v-frfei-msft
Community Support
7 years agoHi Anonymous ,
One sample for your reference. Here I created two calculated columns to work on it. Please notice I modified your data a bit to make the logic more reasonable.
INT =
VAR total =
CALCULATE (
SUM ( [%of customers] ),
FILTER (
Table1,
Table1[Branch Number] = EARLIER ( Table1[Branch Number] )
&& Table1[Local AN] <= EARLIER ( Table1[Local AN] )
)
)
VAR no =
INT ( total * 10 )
RETURN
no
Result =
VAR cou =
CALCULATE (
COUNTROWS ( Table1 ),
FILTER (
Table1,
Table1[Branch Number] = EARLIER ( Table1[Branch Number] )
&& Table1[Local AN] <= EARLIER ( Table1[Local AN] )
&& Table1[INT] = 8
)
)
RETURN
IF ( Table1[INT] <= 8 && cou <> 2, 1, 0 )
Pbix as attached.