How to check if dimension value is available on all days in tableau - tableau-desktop

I have two input dimensions i.e. Day and Product_sold and I want to create a calculated field "Flag" in Tableau. Basically Flag will show "Yes" if the product was sold on all days, else No (see example attached), can you please help? I have tried multiple things but no use

You can create a fixed LoD calculation to count distinct number of days in data. Then used another fixed LoD (or possibly a table calc) to count distinct days for each product. If the product COUNTD = dataset COUNTD than it sold on every day.

What have you tried so far? This looks like a simple attribution calc that could be put together as boolean eg:
Product_sold = 'computer'
Steve

Related

Tableau: how to create calculated field for previous day value

I have created a monthly calendar in tableau that tracks enrollment sign ups for a business's rewards program. What I am trying to do is show the day over day % change between enrollment values. In this specific scenario, I am trying to find the % change between 371 to 499. However, to do this, I believe I first need to create a calculated field for the prior days value, so that I can then use the day over day % formula for all other values. Does anyone have any advice for this particular scenario?
I have tried using the datediff function, amongst other calculated fields, with no luck so far. I want to created a calculated field that will retrieve all "enrollment" values but only for the previous day, so that I can then use the "100*((final-initial)/initial) calculation to calculate the day to day % difference.
You can try this function. I think this might be the calc you need.
(ZN(SUM([Distance])) - LOOKUP(ZN(SUM([Distance])), -1)) /
ABS(LOOKUP(ZN(SUM([Distance])), -1))
You might have to play with the sign to get the result you want. Let me know if that doesn't work.

Repeat cell values and increment them afterwards

I'm trying to set up a structure in a sheet that allows for a date value to be incrementally (monthly) increased from a given start date. However, I also want each month to be repeated x times before it moves on to the next month, which should then also be repeated x times before moving on, and so on, until a given end date.
I've created this sheet to exemplify my desired output.
In the Example tab, I have a list of names (Sales reps) which, in this case, correspond to the "x" I mentioned previously. This means that I would like each date value to be repeated the same number of times as there are sales reps, before moving on to the next month and repeating it again the same number of times as there are sales reps. This also means that, if I increase the number of sales reps at some point, that should also be reflected in the number of times that a month is repeated. Also, the start and end dates should match the values in D3 and D5.
In columns D and E in the Example tab, I just wrote the kind of behaviour I'm looking for in static values. Can anyone help me fill in the Desired solution tab with a formula that automatically achieves that? That would be much appreciated 🙏🏻😃
EDIT: THINGS TRIED SO FAR
I created a new tab called Undesired solution where I show a hacky workaround that I tried, but that I would like to keep away from. The main reason for that is that, if the number of sales rep was to change:
I would have to manually update the first few cells of column F
I would have to manually update the formula used from G5 onwards
Here's how it looks filled with an array formula. I'm using counta() to get the number of names and month() to get the difference between start and end date in months, then applying sequence with int and mod to get the index of the required date and name, finally applying edate and vlookup to get the actual date and name.
=ArrayFormula({edate(D3,int(sequence(COUNTA(B3:B)*(month(D5)-month(D3)+1),1,0)/COUNTA(B3:B))),
vlookup(mod(sequence(COUNTA(B3:B)*(month(D5)-month(D3)+1),1,0),COUNTA(B3:B)),{sequence(rows(B3:B),1,0),B3:B},2)})

subtotal with product condition after applying date filter on google sheet

I am struggling to find the right formula for my table. I have a database that I want to filter per date and get the total of each product on a different page.
As I need to prepare these products per day I would like to avoid counting every product by hand.
I have this formula =SUMIF(E40:E52,"Reese - box of 4*",D40:D52)that work without filter.
How can I do this function with filter?
image
My second question is about when an order as more than one product.Like here, we have a box of 4 that contains the product behind.
image
How can I get a count of the total number of each product, applying the filter option as well?
Thanks a lot for your help!

Is there a google sheets function to count with using arrays of sums as criteria?

I have been struggling for a few days with this problem. Anyone kind enough to show some interested will be highly appreciated.
I have the table shown below.
Suppose columns represent months. I would like to know up to which months' orders have been used up.
I have tried criteria with sums of demand up to that point but I cannot seem to use criteria with the sum of total demand and an array of sums of "total units ordered".
F.e. =COUNTIF(SUM($S$2:($S$2:S$2))<SUM($S$1:S$1) is not possible.
I have tried using an index-match combo but i would have to deduct the previous max sum of "total units ordered" that meets the condition up to the previous cell.
Is that possible without using vba?
Thanks in advance for your interest and time spent.
You can use a standard method of getting running totals using Sumif, combined with Match:
=ArrayFormula(match(sumif(column(S1:Z1),"<="&column(S1:Z1),S1:Z1),sumif(column(S2:Z2),"<"&column(S2:Z2),S2:Z2))-1)
I put rows 3 and 4 in just as a check of my calculations and to show the results of the two Sumifs evaluations - they aren't necessary.
You may wish to specify what should happen if the demands add up to exactly 3000, for example. The above formula would actually go to the next month, so may need some refinement if that is not what you want.

Google Sheets: Dense Ranking from sorted values

I have a simple table with 3 columns:
[Name] [Score] [Rank]
For the 3rd column, I'm using the following formula to rank each row according to the score:
=RANK(C9,$C$9:$C$28,0)
The problem is that the formula isn't returning the values I'd expect. For example on the last row it returns 19 when it should be 5.
I found other formulas for ranking (RANK.EQ, etc.) but same issue happens.
Here is the Google Sheet to see it in context:
https://docs.google.com/spreadsheets/d/1P1m7UHPPIcQLQkzpnk-SI1y7-0mhKytCWDjA6FJzFrM/edit?usp=sharing
Any guidance appreciated
The results you want can be achieved with a simple MATCH formula:
=match(round(C9,0),NamedRange1,0)
Provided an array (named NamedRange1 for above) is created, say with:
=sort(unique(round(C9:C28,0)),1,0)
I think the result is as intended. Check this Ranking Wikipedia page (called 'standard competition ranking'). It says:
Standard competition ranking ("1224" ranking)
In competition ranking, items that compare equal receive the same
ranking number, and then a gap is left in the ranking numbers. The
number of ranking numbers that are left out in this gap is one less
than the number of items that compared equal. Equivalently, each
item's ranking number is 1 plus the number of items ranked above it.
This ranking strategy is frequently adopted for competitions, as it
means that if two (or more) competitors tie for a position in the
ranking, the position of all those ranked below them is unaffected
(i.e., a competitor only comes second if exactly one person scores
better than them, third if exactly two people score better than them,
fourth if exactly three people score better than them, etc.).
Thus if A ranks ahead of B and C (which compare equal) which are both
ranked ahead of D, then A gets ranking number 1 ("first"), B gets
ranking number 2 ("joint second"), C also gets ranking number 2
("joint second") and D gets ranking number 4 ("fourth").
What you want is 'dense ranking' and it can be achieved by pnuts's answer or something like this:
set G9 to 1
set G10 to =if(round(C10,0)<round(C9,0), G9+1, G9)
copy G10 and paste it into G11:G28
Sample sheet is here.
Thanks to #pnuts and #sangboklee for your solutions. I think I have a good solution now. It is pnuts's solution, just simplified:
=match(round($C9,0),sort(unique(round($C$9:$C$28,0)),1,false),0)
This essentially "embeds" the created array within a single formula, that can be applied to all rows. And as a bonus, the values don't even have to be sorted.
Please check for correctness folks, but I think this works. I've updated the linked Google Sheet from the original question description (it's "Solution 2b").

Resources