Forum Discussion
MEASURE TO FILTER?
- Anonymous2 years ago
Hi,383man
I am glad to help you.According to your description, you want to calculate the number of users, if there is a record with the suffix “BKR”, then directly return its “CUST COUNTS” value.
But sometimes there are no breakers, if there are no breakers, then calculate all the non-repeated numbers and add them up 327+117+180+....
If my understanding is correct, you can refer to my following test
First I recreated two tables and de-duplicated the duplicate data in them
like this:Then I created three measures
Total CUST COUNTS BKR = CALCULATE(SUM('Table_2'[CUST COUNTS]),FILTER('Table_2',RIGHT('Table_2'[NAME CORRECTED], 3) = "BKR"&&'Table_2'[Feeder]=MAX('Table_2'[Feeder]) ) )Total CUST COUNTS NotBKR = CALCULATE(SUM('Table_2'[CUST COUNTS]),FILTER('Table_2',RIGHT('Table_2'[NAME CORRECTED], 3) <>"BKR"&&'Table_2'[Feeder]=MAX('Table_2'[Feeder]) ) )M_result = IF( COUNTROWS( CALCULATETABLE('Table_2', FILTER('Table_2', RIGHT('Table_2'[NAME CORRECTED], 3) = "BKR") ) ) > 0, [Total CUST COUNTS BKR], [Total CUST COUNTS NotBKR] )The final test result is as follows:
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,383man
I am glad to help you.
According to your description, you want to calculate the number of users, if there is a record with the suffix “BKR”, then directly return its “CUST COUNTS” value.
But sometimes there are no breakers, if there are no breakers, then calculate all the non-repeated numbers and add them up 327+117+180+....
If my understanding is correct, you can refer to my following test
First I recreated two tables and de-duplicated the duplicate data in them
like this:
Then I created three measures
Total CUST COUNTS BKR =
CALCULATE(SUM('Table_2'[CUST COUNTS]),FILTER('Table_2',RIGHT('Table_2'[NAME CORRECTED], 3) = "BKR"&&'Table_2'[Feeder]=MAX('Table_2'[Feeder])
)
)
Total CUST COUNTS NotBKR =
CALCULATE(SUM('Table_2'[CUST COUNTS]),FILTER('Table_2',RIGHT('Table_2'[NAME CORRECTED], 3) <>"BKR"&&'Table_2'[Feeder]=MAX('Table_2'[Feeder])
)
)
M_result =
IF(
COUNTROWS(
CALCULATETABLE('Table_2',
FILTER('Table_2', RIGHT('Table_2'[NAME CORRECTED], 3) = "BKR")
)
) > 0,
[Total CUST COUNTS BKR],
[Total CUST COUNTS NotBKR]
)
The final test result is as follows:
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.