Filtering Question
I have a mega table report that is displaying customer invoice data. One of my filters is for the Aging Range. I have been asked to modify the filter to include all invoices for a customer if any of their invoices are in the filtered range. Meaning that in the below dataset if they selected to filter 151-180 all invoices for Customer A would still be in the report. This allows the user to see a full picture for that customer.
Maybe my brain is just tired, but I'm just drawing a blank on how to make this happen.
Customer | Invoice | Aging Range |
---|---|---|
Customer A | Invoice 1 | 151-180 |
Customer A | Invoice 2 | 91-120 |
Customer A | Invoice 3 | 31-60 |
Customer A | Invoice 4 | 1-30 |
Customer A | Invoice 5 | 1-30 |
Customer A | Invoice 6 | 1-30 |
Customer A | Invoice 7 | 1-30 |
Customer B | Invoice 8 | 91-120 |
Customer B | Invoice 9 | 31-60 |
Customer B | Invoice 10 | 31-61 |
Customer B | Invoice 11 | 31-60 |
Customer B | Invoice 12 | 1-30 |
Customer B | Invoice 13 | 1-30 |
Best Answer
-
There unfortunately is no way to dynamically set the default for a variable without using code engine. However maybe you could make the default value "MAX" and then update your beast mode?
CASE
WHEN MAX(CASE
WHEN Days Aging>= From
AND Days Aging<= CASE WHEN To = "MAX" THEN <Your Dynamic Value> ELSE To END
THEN 1
ELSE 0
END)
OVER (PARTITION BY Customer) > 0
THEN 'Include'
ELSE 'Exclude'
END0
Answers
-
Add a calculated field that determines whether a customer should be included based on their invoices. This field will check if any invoice for a customer falls within the selected aging range. Simplified….
Customer In Range:CASE
WHEN `Aging Range` = '151-180' THEN 1
ELSE 0
ENDAggregate the customer inclusions. To ensure all invoices for a customer are displayed, you'll need a formula to determine if any invoice for a customer falls with the range.
Include Customer:SUM(CASE
WHEN `Aging Range` = '151-180' THEN 1
ELSE 0
END) > 0Then you need a filter.
Show All Invoices For Selected Range:CASE
WHEN SUM(CASE
WHEN `Aging Range` = '151-180' THEN 1
ELSE 0
END) OVER (PARTITION BY `Customer`) > 0
THEN 'Include'
ELSE 'Exclude'
ENDUse the Show All Invoices For Selected Range to filter your report. Set the filter to only show rows where this filed equals "Include".
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Thanks for your response. I'm following the logic, but I'm guessing I wasn't clear enough. The user has the ability to select from multiple ranges. Maybe my brain has just decided to take a vacation, but I can't put 2 and 2 together.
0 -
I was able to figure it out in the end. Thanks for the jumping off point.
CASE
WHEN MAX(CASE
WHENAging Range
IN ('1-30','31-60','61-90','91-120','121-150','151-180','181-365','>365')
THEN 1
ELSE 0
END)
OVER (PARTITION BYCustomer
) > 0
THEN 'Include'
ELSE 'Exclude'
END0 -
Sorry, that's what I meant by "simplified". I didn't have the time to fully think through the whole solution.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
No worries. I was wrong anyways. It's not working. I swear it was, but I'm back to just filtering by the ranges selected. Ugh
0 -
You can do this by combining a Variable with a Fixed Function. First create a variable named "Age Range" and populate it with your
Aging Range
bins, then create a beast mode:CASE
WHENCustomer
= MAX(MAX(CASE WHENAging Range
=Age Range
THENCustomer
END) FIXED (BYCustomer
))
THEN 'Include'
ELSE 'Exclude'
ENDplace the beast mode in your filter and filter on the value "Include"
0 -
Thanks. I am able to get it to work using a variable, but I was really hoping I wouldn't have to. One of the most highly requested feature when I first convert this report from Excel was the ability to filter on multiple ranges. As variable only allow single select that kills that. Ugh.
0 -
In order to apply a range filter, you need a number to filter on rather than text. If you were to include the actual age of the invoice in your dataset then you can filter on the range of days. In your example that would be 0 to 180 days.
However, a range filter would also include the invoices for Customer B. If you still want a result that filters to only Customer A you might need a MAX AGE field
0 -
In the case that the range selected was 0-180 (1-30,31-60,61-90,91-180) then yes, Customer B would also be included. I do have the raw Aging days. The frustrating thing is that by using the Aging Range or Aging Days the reports seems to filter on those before filtering on the Include/Exclude flag. Either that, or the Partition by just isn't working. I'm going to mess around with fixed by a bit more and see if I can stand on 1 foot under the full moon spinning in circles long enough to get it to work.
0 -
I have come up with a potential solution. It feels very bulky at the moment and there is one annoying element. I created 2 textbox variables, 'From' and 'To'. I set the defaults to 1 and 365 respectively. The intent is to dynamically select the desired range. I then modified my beast mode.
CASE
WHEN MAX(CASE
WHENDays Aging
>=From
ANDDays Aging
<=To
THEN 1
ELSE 0
END)
OVER (PARTITION BYCustomer
) > 0
THEN 'Include'
ELSE 'Exclude'
ENDThe annoying part is that without defaulting the 'To' variable to something annoyingly high there is no good way to include everything over 365. I have the variable set as a number in order to use Days Aging meaning I can't use something like 'max'. Is there a way to dynamically set the default for a variable?
0 -
There unfortunately is no way to dynamically set the default for a variable without using code engine. However maybe you could make the default value "MAX" and then update your beast mode?
CASE
WHEN MAX(CASE
WHEN Days Aging>= From
AND Days Aging<= CASE WHEN To = "MAX" THEN <Your Dynamic Value> ELSE To END
THEN 1
ELSE 0
END)
OVER (PARTITION BY Customer) > 0
THEN 'Include'
ELSE 'Exclude'
END0 -
I didn't think that would work because text and number fields usually don't work well together. But it did! Thanks everyone for the ideas!
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive