Forum Discussion
DAX - Create measure to count Store type
- 6 years ago
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.
v-alq-msft Thanks a lot..