Forum Discussion
Anonymous
5 years agoNot applicable
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...
- 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 regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
selimovd
Most Valuable Professional
5 years agoHey 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
Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic