Skip to main content

#LOD9 discussing

I have a dashboard based on multiple published Cloud data sources - 

Primary

= Agent Daily Structure 

Blended to

multiple KPI data sources on staff number and date only 

 

The end user wants to see multiple KPIs on a dashboard page showing the grand total and then splitting the agents into quartiles (just the 4 totals showing).  They then want to be able to use filters to change the month or drill down/by department/manager etc to which the quartiles will re-adjust. 

 

I tried building my initial data source in Prep, as all of the sources are already published to Cloud, with left joins on staff number and date to the primary data source and cleaning up, rather than the 'blends' but the agent-level totals for the KPIs did not reconcile against the data source in isolation, before even trying quartile calculations, hence trying it the 'blended way'.  This is giving correct agent and grand totals. 

 

I have tried various ChatGPT suggestions but none of them work (sometimes its a great AI tool, but in this case no!).  I've not been able to find anything in forum posts/guides that seems to suit my scenario.   Can you help?  

 

This one 90% works using a DATETRUNC to 'month-date' blend on each data source, rather than individual date - QA score

 

Fixed LOD Calc 1

=  

{ FIXED [Agent ID] , [DateTrunc - Month]: (AVG([Evaluation Score])/100) } 

 

Creating the Quartile groups

=  

IF [Fixed LOD - QA] <= { PERCENTILE([Fixed LOD - QA], 0.25) } THEN "Q4 - Bottom Performers" 

    ELSEIF [Fixed LOD - QA] <= { PERCENTILE([Fixed LOD - QA], 0.50) } THEN "Q3 - Coaching Needs" 

    ELSEIF [Fixed LOD - QA] <= { PERCENTILE([Fixed LOD - QA], 0.75) } THEN "Q2 - Good Performers" 

    ELSEIF [Fixed LOD - QA] > { PERCENTILE([Fixed LOD - QA], 0.75) } THEN "Q1 - Top Performers" 

    END  

 

Quartile groups on rows, QA score on column and the text mark to display in columns.  This works 90% for QA score (the totals for each Q at least look reasonable and adjust when filtering) - the odd agent appears under the wrong quartile when adding agents to the view to check the quartile calc/sorting highest to lowest.  But if I try the same calc on another Quality metric in the same data source it doesn't work at all - its grouped everyone under the bottom 2 quartiles. 

 

I've tried multiple ChatGPT suggestions using Windows_Percentile and Rank_Percentile and using the staff number or staff number and date on the 'detail mark' and keeping the first row, but none of these work. 

 

I need a reliable way to split agent performance on a KPI into quartiles using this blended data source, that can be filtered.  Surely something like it exists/its not an impossible ask!!  TIA 

 

#Tableau Desktop & Web Authoring  #Tableau Cloud  #LOD

1 answer
  1. Oct 20, 4:00 AM

    Hi @Kirsty Barlow

     

     

    Your quartile logic itself looks fine. I tested the same pattern (FIXED [Agent ID] -> FIXED PERCENTILE -> IF ... <= cut-off) in a single data source with sample data, and it splits 120 agents evenly into four groups of 30. So I would look at these two things: 

     

    1. The metric that "groups everyone under the bottom 2 quartiles" probably has many tied values. If more than 25% of agents share the same value (e.g. 100%), the 25/50/75% cut-offs become identical and "<=" puts all of them in the lower groups. In my test, 60% of the agents scored 100: 90 agents landed in Q3, 30 in Q4, and none in Q1/Q2. No value-based split can separate tied agents, so use a tie-breaker (e.g. a second metric added as a tiny weight) or treat that value as its own group. 

     

    2. The quartiles not re-adjusting properly is likely related to the blend. FIXED LODs ignore dimension filters unless the filters are context filters, and LODs on secondary-source fields are computed within the secondary source. I would combine the data in one source (in Prep, aggregate each KPI source to one row per staff number + date before joining, to avoid duplicated rows) and then right-click your Month / Department / Manager filters and choose "Add to Context". 

     

    I attached a small workbook with synthetic data: sheet 1 is your calculation in a single data source, sheet 2 shows the tie case.

0/9000

Hi everyone,

I’m trying to solve a Tableau issue involving FIXED LOD calculations, a Max Run Date context filter, row-level highlighting, and a blended data source.

Background

I have a dashboard with two sheets/tabs.

Sheet 1 – New Prescribers

This sheet identifies New Prescribers at the HCP level.

The sheet has the following filters:

  •  Max Run Date Flag = True — in context
  •  Trial = True 
  •  User Filter = True 
  •  Several territory/region dimensional filters 

My Avg Patients calculation is:

{ FIXED [NPI], [Month] :

AVG([unique_patients_yutrepia_winrevair_zinc_cvs])

}

My New Prescriber calculation is:

ZN([Avg Patients]) > 0

AND

{ FIXED [HCP] :

MAX(

IF [Run Date] < { MAX([Run Date]) }

AND ZN([Avg Patients]) > 0

THEN 1

ELSE 0

END

)

} = 0

Sheet 2 – Summary/Output Table

The second sheet is an output table that is being rendered through a SuperTable extension.

The row dimensions are approximately:

HCP

Institution

CPS Region

ALD Region

NPI

CPS Territory

ALD Territory

NPI Specialty

State

ZIP

...

The table also contains monthly patient measures such as:

Jun Est Pts

Jul Est Pts

Aug Est Pts

I am not displaying the New Prescriber field as a column.

Instead, I need to use New Prescriber only to highlight the entire row of the 5 New Prescribers in SuperTable.

The problem

Initially, I did not have Max Run Date Flag in context on Sheet 2.

I placed the New Prescriber field on Detail so that SuperTable could use it for row highlighting.

This worked correctly:

The table had the correct number of rows.

The 5 New Prescribers could be identified/highlighted.

However, I also have a ratio calculation involving two data sources:

Yutrepia Patients → Primary data source

Shipment Patients → Secondary/blended data source

Without Max Run Date Flag in context, the ratio does not return the expected values.

When I add Max Run Date Flag to Context

The ratio/counts become correct.

However, once Max Run Date Flag is in context, putting the New Prescriber field on Detail causes the table to split/increase rows.

For example, an HCP that should appear as one row can effectively get split because of the New Prescriber value at the underlying record level.

I don't want New Prescriber to change the existing row grain. I only want it to act as a highlighting flag.

So I currently have this conflict:

Setup Result

Max Run Date NOT in context Correct row count + New Prescriber highlighting works, but ratio is incorrect

Max Run Date IN context Ratio is correct, but New Prescriber on Detail causes additional/split rows

What I am trying to achieve

I need all of the following simultaneously:

Keep Max Run Date Flag as a context filter because it currently makes the blended ratio calculate correctly.

Identify the same 5 New Prescribers as Sheet 1.

Use the New Prescriber result only for row highlighting in SuperTable.

Do not add New Prescriber to the dimensional grain or create additional rows.

Keep the Yutrepia Patients / Shipment Patients ratio accurate.

Maintain the existing HCP/NPI/institution/etc. row structure.

My questions

1. Why does adding Max Run Date Flag to context cause the New Prescriber field on Detail to split/increase the rows?

I understand Tableau's order of operations, but I'm not clear on exactly how the context filter is interacting with my FIXED [HCP] calculation and the existing row grain.

2. Is there a way to calculate the New Prescriber flag at the HCP level and expose it to SuperTable without making it part of the mark's dimensionality?

For example, should I be using an aggregated version such as:

MIN([New Prescriber Flag])

or

ATTR([New Prescriber Flag])

instead of placing the dimension directly on Detail?

3. Is my current New Prescriber LOD logically correct when Max Run Date Flag is a context filter?

The calculation needs historical Run Dates because it checks:

[Run Date] < { MAX([Run Date]) }

But the context filter may be restricting the data before the FIXED LOD is evaluated.

Could this be the reason for the unexpected behavior?

4. Most importantly, how can I solve the ratio and highlighting requirements without increasing the row grain?

Would the recommended solution be to:

change the LOD,

create a separate HCP-level flag,

use a separate data source/relationship,

use a table calculation,

use an aggregated field on Detail,

or handle the Max Run Date differently?

One additional detail

The Avg Patients calculation is:

{ FIXED [NPI], [Month] :

AVG([unique_patients_yutrepia_winrevair_zinc_cvs])

}

while the New Prescriber logic is fixed at [HCP].

The output table itself contains several dimensions below/alongside HCP.

So I suspect there may be a grain mismatch between [NPI] + [Month], [HCP], and the output-table grain, but I'm not sure whether that is the actual root cause.

What would be the recommended Tableau approach to achieve this without duplicating/splitting the rows?

this is from databricks sourc and i don;t have access to those sources so couldn't share the .TWBX file part of confidential.

Thanks!

This correctly identifies 5 HCPs as New Prescribers

on Sheet 1. 

 

#Tableau Desktop & Web Authoring  #LOD

5 answers
  1. Sep 18, 5:46 AM

    Hi, @Himshikha Purohit 

    I apologize for the delayed response. 

    Based on the information available at this point, it seems difficult to fully understand your issue. 

     

    If possible, could you create a small set of dummy data that reproduces the problem, build a workbook using that data, and share it with us? 

    Thank you for your consideration.

0/9000

I have a complicated issue due to how the shareholders want the data displayed and the calculations involved. 

What I am trying to do is simply get for Month 1 for the [Projected Carry From Prior Month] to be  

Month 0 ([Shipments Calc] + Month 0 [LOD Actual Demand]) -  Month 0 [Forecast) resulting in 24,422 ((14,490 + 111,872)-101,940). 

 

I kept the Old Formula for the [Projected Carry From Prior Month] metric in the workbook as it is made up of three calculations. The issue is when i bring in [LOD Actual Demand] I get the error of cannot mix aggregate and non-aggregate. No matter what I try I cant get the error to fix unless I break the [LOD Actual Demand] by taking off the additional SUM in the formula which results in the wrong answer. Any help would be greatly appreciated. Tried multiple  

 

Expected End Result of formula: 

Month 0 is 0 by default since there is no carryover. So for  

Month 0 the calc should show 0,  

Month 1 the calc should show 24,422 

Month 2 the calc should show 12,844 

Month 3 the calc should show 13,756 

Hoping there is a Fix for this LOD

 

 resources before asking here and they could not figure this out 

( 

 

#Tableau Desktop & Web Authoring  #LOD  #Formulas  #Tableau

7 answers
  1. Sep 14, 1:50 PM

    Thank you. I actually solved my own issue by (like most issues in Tableau) restructuring my data tables using SQL since Tableau can't handle calculations like PowerBI or Microstrategy. I simply combined the Actual Demand with the Past Due Tons before ingesting it to Tableau, therefore eliminating the additional LOD for Past Due Tons. Its wild to me how limiting Tableau is with calculations especially if you have used other BI tools. Thank you all for your help. 

0/9000

Need help with the following LOD called "LOD Line Weekly Past Due Tons". Its essentially tons that have not shipped from prior months up to the current Month (Month 0). I would expect 11,562 to appear on every Month Number. I can get that with a simple Exclude. however when trying to add to "Actual Demand" of 100,310 I get 111,348 instead of 111,562. See "LOD Actual Demand Week" for the formula where I expected to see 111,562. Any Ideas how to get this to be able to add across correctly. See Test Tab 2

 

#Tableau Desktop & Web Authoring  #LOD  #Formulas  #Tableau

2 answers
  1. Sep 3, 10:07 PM

    @Blake Swan

     

    Hi, you may use:

    SUM({ FIXED [Charter Product Type],

    [Customer Name],

    [Customer Number],

    [Market Segment],

    [Product Type],

    [Month Number In Relation To Current]:

    SUM(

    IF [Month Number In Relation To Current] = 0

    THEN [Actual Demand]

    END

    )

    })

    +

    SUM({ SUM([Line Weekly Past Due Tons])

    })

    If this post resolves the question, would you be so kind to "Accept this Answer"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you. 

     

    Regards, 

     

    Diego Martinez 

    Tableau Visionary and Tableau Ambassador 

0/9000

Still time to register for our next #Analytics #Tableau User Group and learn about #LOD #MapLayers and #Accessibility

 

 

🖇️ 

https://usergroups.tableau.com/events/details/tableau-analytics-tableau-user-group-presents-analytics-tableau-user-group-lods-map-layers-amp-accessibility

 

 

📅 January 29th at 6PM Paris Time - 12PM New York Time - 10:30PM New Delhi 

 

Event Details : 

 

⭐

Chris Williams

: Explore the power of Tableau LOD (Level of Detail) ExpressionsLearn how these commands enable users to conduct complex calculations by managing data granularity independently from the view’s setup. Discover the importance of LOD expressions for achieving precise analysis and flexible reporting. We will delve into the three types of LOD expressions—FIXED, INCLUDE, and EXCLUDE—each enhancing analytical capabilities by facilitating diverse aggregation levels. Join us to enhance your data analysis proficiency. 

 

⭐

Prasann Prem

: KPI Cards made simple with Map LayersDiscover how to design powerful KPI cards in Tableau using map layers. Learn how to combine BANs, variances, and trends all in one sheet for more flexible dashboards. 

 

⭐

Doc Kevin Lee Elder 

Kevin Lee Elder : The First Step to Building Accessible Dashboards: Do You See the Data?The data viz rule for colorblindness? “Don’t use red and green together.” It is too simplistic and is actually wrong! We Do See Red & Green it just looks different to us! Learn how to select colors and design colorblind-friendly visualizations from a color vision deficient (CVD) point of view. Let everyone see your data more easily which is also the first step towards insights. 

 

Come and ask questions to our guests! See you soon! 

0/9000