Hi
I am using pivot table to show the amount of total diagnoses (to be referred as value) per category (source) per clinic.
The clinic is for the user to choose from a dropdown.
The pivot includes the value per source.
I need the pivot table to include all sources that are available in the table, not just the ones which the specific clinic has. The purpose is to show sources with zero values.
For example (see attached figure) there should be additional sources with zeros as values.
Do you have any work around to accomplish this in Quicksight?
Hi @tomer1,
So if I understand correctly, you’d like to create a static field that lists all sources, so even if a specific location/clinic does not have that source, it will still be on the list?
There have been a couple other recent posts that were similar to this request, take a look at the posts below and let me know if one works as a solution for your case:
I read to attached posts and not sure they are relevant.
I’ll try to better reflect the issue here:
Clinic is associated to EHR (could be one of 4 options).
Each EHR has it’s own set of relevant sources. For example, in Athena EHR, the relevant sources are: Encounter, Inferred, Problem, Document, Claims.
In the attached figure is example of clinic that lack some of the sources.
Regarding your issue, I have a question: Are you sure that your dataset includes null or zero data for each category? It seems to me that you need to verify whether the information, even if it’s zero, is present in your dataset for each category you wish to display.
The dataset doesn’t include nulls for each category. This is why I wish to make a left join here.
Is there a way to create a calculated field to show all relevant sources per EHR?
And then create another calculated field that calculates the value per source?
In this example, when choosing from dropdown any Athena clinic, I wish to see all relevant sources - in this example 4 sources: Inferred, Encounter, Document, Problem.
The challenge is to make a pivot table that will include all sources per EHR (in this example - 4 sources), then add another calculated field with the value per source. If the source doesn’t exist for the chosen clinic, then show 0.
There is some suggestions for make it work:
You can perform a left join in quicksight(qs) using the Data Prep interface. However, for complex or large datasets, it’s often more efficient to handle joins in a separate data preparation tool or during the ETL process. But if you really want to do this in qs:
Reference Table: create a reference table with all possible combinations of EHR, clinic, and sources.
Left Join: In qs Data Prep, import your original data and the reference table. Use the “Join” feature to perform a left join.
Calculated Fields: Use ifelse(isNull({value}), 0, {value}) to replace nulls with zero.
Pivot Table Setup: Configure your pivot table to display the joined dataset, ensuring it shows null or zero values.
Hi @tomer1,
It’s been awhile since we last heard from you, did you the solution provided above work for your case or did you have additional questions?
If we do not hear back within the next 3 business days, I’ll close out this topic.
Hi @tomer1,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.