Forum Discussion

Mente73's avatar
Mente73
Frequent Visitor
1 year ago
Solved

Countby price range

Hello, Can anyone help me out to count the number of purchases by price/amount range?   I currently have a measure as follows: PurchaseCounts =     CALCULATE(COUNT(Transactions[Amount]),     ...
  • DataInsights's avatar
    1 year ago

    Mente73,

     

    This approach uses a disconnected table named Segmentation:

     

     

    Create measure:

     

    Purchase Count Segmented = 
    SUMX (
        Segmentation,
        COUNTROWS (
            FILTER (
                Transactions,
                Transactions[Amount] > Segmentation[Range Min]
                    && Transactions[Amount] <= Segmentation[Range Max]
            )
        )
    )

     

    Result:

     

     

    You can specify the additional filters on Platform, TransactionType, and PaymentBy either in filters or adding them to the FILTER function. Specifying these as filters would enable the measure to be generic and thus reflect any user-specified filters.