Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Everyone,
Based on store type I need the count of unique outlets at month level ( this was done as it is a direct statement). However they want to implement having multiple months selection. While we select multiple month my categorical column store type will change based on each month data. To overcome this problem planning to implement below logic, where I need your expertise.
Table 1:
Store | Month | Store type |
A | Jan | New |
B | Jan | retain |
C | Jan | retain |
D | Jan | new |
E | Jan | new |
F | Jan | retain |
G | Jan | lapsed |
H | Jan | lapsed |
A | Feb | retain |
B | Feb | lapsed |
C | Feb | retain |
D | Feb | retain |
L | Feb | new |
M | Feb | retain |
N | Feb | lapsed |
T | Feb | retain |
Output format (Table 2: )
E | new |
F | retain |
G | lapsed |
H | lapsed |
L | new |
M | retain |
N | lapsed |
T | retain |
A | retain |
B | lapsed |
C | retain |
D | retain |
Final Output (Table 3: )
Store Type | Count |
lapsed | 4 |
new | 2 |
retain | 6 |
Grand Total | 12 |
Thanks in advance
Regards
Venu
Solved! Go to Solution.
Hi, @venug
Based on your description, you can create the Table 2 and Table 3 as follows.
Table 2 =
SUMMARIZE (
'Table 1',
'Table 1'[Store],
"Store type",
VAR j =
CALCULATE (
MAX ( 'Table 1'[Store type] ),
FILTER ( 'Table 1', 'Table 1'[Month] = "Jan" )
)
VAR k =
CALCULATE (
MAX ( 'Table 1'[Store type] ),
FILTER ( 'Table 1', 'Table 1'[Month] = "Feb" )
)
RETURN
IF (
j = "new"
&& k = "retain",
"Retain",
IF (
j = "new"
&& k = "laspsed",
"Lapsed",
IF (
j = "retain"
&& k = "retain",
"Retain",
IF ( k = "" || ISBLANK ( k ), j, k )
)
)
)
)
Table 3 = SUMMARIZE(
'Table 2',
'Table 2'[Store type],
"Count",
COUNT('Table 2'[Store type])
)
Result:
Table 2:
Table 3:
Best Regards,
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @venug
Based on your description, you can create the Table 2 and Table 3 as follows.
Table 2 =
SUMMARIZE (
'Table 1',
'Table 1'[Store],
"Store type",
VAR j =
CALCULATE (
MAX ( 'Table 1'[Store type] ),
FILTER ( 'Table 1', 'Table 1'[Month] = "Jan" )
)
VAR k =
CALCULATE (
MAX ( 'Table 1'[Store type] ),
FILTER ( 'Table 1', 'Table 1'[Month] = "Feb" )
)
RETURN
IF (
j = "new"
&& k = "retain",
"Retain",
IF (
j = "new"
&& k = "laspsed",
"Lapsed",
IF (
j = "retain"
&& k = "retain",
"Retain",
IF ( k = "" || ISBLANK ( k ), j, k )
)
)
)
)
Table 3 = SUMMARIZE(
'Table 2',
'Table 2'[Store type],
"Count",
COUNT('Table 2'[Store type])
)
Result:
Table 2:
Table 3:
Best Regards,
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
95 | |
76 | |
72 | |
65 |
User | Count |
---|---|
140 | |
109 | |
103 | |
82 | |
73 |