Forum Discussion
Division result categorization with data from 2 different tables.
Hello,
I have the following tables:
F_NEWBUSINESS
| DELIVERY_DATE | ACCT_ID | MAIN_DEALER_CODE |
| 31/01/2023 | 1 | A |
| 31/01/2023 | 2 | A |
| 31/01/2023 | 3 | B |
| 28/02/2023 | 4 | C |
| 28/02/2023 | 5 | A |
| 28/02/2023 | 6 | B |
F_DEALERSALES
| DELIVERY_DATE | ID | MAIN_DEALER_CODE | RETAIL_SOLD |
| 31/01/2023 | 1 | A | 3 |
| 31/01/2023 | 2 | A | 5 |
| 31/01/2023 | 3 | B | 2 |
| 28/02/2023 | 4 | C | 1 |
| 28/02/2023 | 5 | A | 0 |
| 28/02/2023 | 6 | C | 4 |
I am trying to categorize the result of the division:
count of newbusiness/sum of retail sold, by main_dealer_code
To calculate the division I have this metric:
I need to show in a Line Chart visual the amount of main dealers that fall under each category with each category being one line in the chart and with the categories being the following:
- dealers FP <20% when Dealer Fin Pen < 0.2
- dealers FP 20-40% when Dealer Fin Pen > 0.2 && Dealer Fin Pen <= 0.4
This last part is where I am having troubles, I am not able to count the amount of main dealers that falls under each category.
Hi, Anonymous
try this one.
Count Dealers FP <20% =
CALCULATE(
COUNTROWS(F_NEWBUSINESS),
FILTER(
ALL(F_NEWBUSINESS),
[Dealer Fin Pen] < 0.2
)
)Count Dealers FP 20-40% =
CALCULATE(
COUNTROWS(F_NEWBUSINESS),
FILTER(
ALL(F_NEWBUSINESS),
[Dealer Fin Pen] >= 0.2 && [Dealer Fin Pen] <= 0.4
)
)Count Dealers FP >40% =
CALCULATE(
COUNTROWS(F_NEWBUSINESS),
FILTER(
ALL(F_NEWBUSINESS),
[Dealer Fin Pen] > 0.4
)
)
2 Replies
- rubayatyasmin
Community Champion
Hi, Anonymous
try this one.
Count Dealers FP <20% =
CALCULATE(
COUNTROWS(F_NEWBUSINESS),
FILTER(
ALL(F_NEWBUSINESS),
[Dealer Fin Pen] < 0.2
)
)Count Dealers FP 20-40% =
CALCULATE(
COUNTROWS(F_NEWBUSINESS),
FILTER(
ALL(F_NEWBUSINESS),
[Dealer Fin Pen] >= 0.2 && [Dealer Fin Pen] <= 0.4
)
)Count Dealers FP >40% =
CALCULATE(
COUNTROWS(F_NEWBUSINESS),
FILTER(
ALL(F_NEWBUSINESS),
[Dealer Fin Pen] > 0.4
)
)- AnonymousNot applicable
Hello rubayatyasmin ,
Seems promising, but thanks to this I have found out, that I have some "." as main_dealer_codes in the data which is giving me problems to calculate the metric due to text to true or false evaluation raising an error, as soon as I solve this, I will let you know if it worked or not.
Thanks a lot and happy new year! 🙂