[]
        
(Showing Draft Content)

Use Case 2 - Transaction Analysis per Customer

Case 2: Transaction Analysis per Customer

Requirement

Per customer transaction refers to the average amount of goods purchased by each customer. The formula used is:

Sum(SaleAmount)/Count(CustomerID)

In this case, we will analyze the Sum(SaleAmount)/Count(CustomerID) in each category.

Steps for creating a dashboard

1. Drag a Column chart and drag the English category name to Axis.

drag-category

2. Add a measure on the table 'FactInternetSales'.

addmeasure2

3. Input the expression given below and save it as MeasurePCT. So the name of the Measure will be MeasurePCT.

Sum('FactInternetSales'[SalesAmount])/count('FactInternetSales'[CustomerKey])

measure-expression1

4. Drag the Measure MeasurePCT to the Values.

mesaurepct

Explanation

sum('FactInternetSales'[SalesAmount])/count('FactInternetSales'[CustomerKey])

The WAX above here is a measure. Measure, in this case, is the arithmetic operation of aggregation functions. The measure could be used directly. It does not allow to choose aggregation options or quick function options.

The whole WAX is below for this dashboard request.

EVALUATE
SELECTCOLUMNS(
    SUMMARIZE(
        CALCULATETABLE(
            SELECTATTRIBUTES(
                'DimProductCategory'[EnglishProductCategoryName]
            )
        ),
        'DimProductCategory'[EnglishProductCategoryName],
        "FactInternetSales_MeasurePCT",
        CALCULATE(
            ( 
                sum('FactInternetSales'[SalesAmount])
                /
                count('FactInternetSales'[CustomerKey])            
            )
        ),
        "DimProductCategory_EnglishProductCategoryName_Order_null",
        CALCULATE(
            ROWNUMBERW(
                CALCULATETABLE(
                    DISTINCT(
                        SELECTATTRIBUTES(
                            DimProductCategory,
                            'DimProductCategory'[EnglishProductCategoryName]
                        )
                    )
                ),
                OrderBy(
                    'DimProductCategory'[EnglishProductCategoryName]
                )
            )
        )
    ),
    "DimProductCategory_EnglishProductCategoryName",
    'DimProductCategory'[EnglishProductCategoryName],
    "DimProductCategory_EnglishProductCategoryName_Order_null",
    [DimProductCategory_EnglishProductCategoryName_Order_null],
    "FactInternetSales_MeasurePCT",
    [FactInternetSales_MeasurePCT]
)