Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Count Total, based on condition from other table

Hi all,   I have a question. I want to counter the numbers of orders per categorie (Groups[Total amount between]). I have 2 tables. 1 table is about the sales with the total amounts per order. Th...
  • selimovd's avatar
    5 years ago

    Hey Anonymous ,

     

    you should set the min and max as variable. Like this you don't have the confusion with row and filter contexts.

    Try the following approach:

    Count = 
    VAR vMin = MIN( Groups[Min] )
    VAR vMax = MAX( Groups[Max] )
    RETURN
        CALCULATE(
            COUNTROWS( Sales ),
            FILTER(
                Sales,
                Sales[Total amount] >= vMin && Sales[Total amount] <= vMax
            )
        )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis