Appreciate if anyone could advice how can I apply the Running-Total function for multiple measures?
I have 2 measures (Count) and (Revenue) by Month (Row) and Year (Column)
Product A Product B
2014 2015 2014 2015
Count | Revenue Count | Revenue Count | Revenue Count | Revenue
Jan 100
Feb 200
YTD 300
Mar 555
YTD 855
I tried with
running-total (currentMeasure for [Month], [Year], [Product Type])
but there is error claims that currentMeasure is not supported for QueryPackage.
In case I interpreted the message wrong, appreciate for your advice how can I apply the running-total correctly for multiple measures.
Thank you.
Count
running-total([Count] for [Product Type],[Year])
Revenue
running-total([Revenue] for [Product Type],[Year])
You don't specify month because it is in the row header. The 'for' clause indicates the grouping and the grouping comes from the column headers while the month defines the row grain. Another way to think about it is to put it into English:
Within each Product Type and Year combination, show me the accumulating total of each succeeding row broken out by Month.
Also, currentMeasure is used only in dimensionally-sourced reports, I believe.
Related
My data looks some thing like this:
Product 1
Date
Site1_Sales
Site2_Sales
Site2_Sales
x1
1-Jan
100
200
300
x2
2-Jan
60
51
150
X1
2- Jan
110
30
40
There will be 1000s of rows with repeated Product but with unique dates. This is what I would like to find:
What was the Max sales for a product ? and on which date ? I tried using Maxifs but it ends up with value error it looks it can handle only continuous ranges.
What was the sum of sales for a product for specific period e.g first 10 days ?
Any help is really appreciated. Thank you
see “Remarks” about #value error:
https://support.microsoft.com/en-us/office/maxifs-function-dfd611e6-da2c-488a-919b-9b6376b28883
SUMIF works in the same way as MAXIF (e.g. you could use a start date and end date as multiple criteria)
FILTER should help you to find the date(s) of max. Sales as well
I have a table like this:
Year Num Freq. Exam Grade Course
2014 102846 SM SM Astronomy 3
2015 102846 12,6 1,7 NC Astronomy 2
2017 102846 20 11,8 17 Astronomy 2
2015 102846 SM NC Defence Against the Dark Arts 4
2015 102846 11 4,5 NC Herbology 2
2015 102846 15 13,99 14 Herbology 2
I am trying to get the percentage of approved students (Grade >= 10) for each course by year and global average.
I've been trying for nearly 3 hours to do a calculated field but so far the only thing I could get was the sum of each student per year:
I have tried to do a calculated field with = Grade >= 10 hoping that it would give me a list of approved students but it gives me 1.
What am I doing wrong in here? It's my first time working with pivot tables.
I would really recommend to not mix string type (text) together with numbers. It's a horrifying idea and will cause a lot of headache when data will be used for calculations (both Freq. and Grade). Rather I would use 0 or some numeric value to represent the text.
Not recommended, but yes it's doable =)
You need some dummy variable to point out which row is number and which is text. So I created Grade Type. We can now count only the rows that have a number in the Grade column by using Grade Type = Number.
I create a table of the data and add the column Grade Type. I use this formula to get Grade Type:
=IF(ISNUMBER([#Grade]),"Number","Text")
I then create the following measures:
Nr of Approved Students
=COUNTX(FILTER(Table1, Table1[Grade Type]="Number"),
IF((VALUE(Table1[Grade])>=10),VALUE(Table1[Grade]),BLANK()))
First we filter which rows that should be evaluated (COUNTX(<table>,...)). If yes, then only count for rows that fulfill >=10, where VALUE() converts string number to numeric (COUNTX(...,<expression>)).
Nr of Student (w/ Grade Number)
=COUNTX(FILTER(Table1, Table1[Grade Type]="Number"), VALUE(Table1[Grade]))
Count all rows that have a number
Approved (% of Total)
=[Nr of Approved Students]/[Count of Grade]
Setup the PowerPivot Table
Create the PowerPivot and add the data to the data Model
Then create a new measure by clicking your pivot table and then "Measures" -> "New Measure..."
Fill in all the relevant data.
Result should be something like:
I have two tables of different length:
a table of monthly data (e.g.: value of inventory at start of month)
a table of sporadic events which happened at random point throughout the year (e.g.: truck delivery to storage)
In table one, I would like to count in an extra column, the number of events from table 2 that occurred in that month. The table with the value of the inventory would show a count per row of how many trucks were unloaded.
I've been fighting with countifs but I just cannot get it to work due to different table lengths, the weird way to enter criteria etc.
I've tried to match the month and year of a truck delivery with the period in the inventory table.
=COUNTIFS(
<range: Dates of Truck deliveries from Table2>, "=MONTH(" &
<cellOfInventoryDate> & ")",
<range: Dates of Truck deliveries from Table2>, "=Year(" &
<cellOfInventoryDate> & ")")
I have a feeling there is a simple solution to this an dI just hit a wall.
Thanks
Table
1 - Inventory at start of month
01/01/2015 1000
01/02/2015 1200
01/03/2015 1100
01/04/2015 900
...
Table 2 - Date of Truck Delivery
01/01/2015
04/02/2015
07/02/2015
03/04/2015
11/07/2015
Ok, so here the answer.
I created a helper column in Table 2 which normalises the dates to the first of the month
=EOMONTH(cellwithdate,-1)+1
then I used countif (not countifs) to count when the date of the inventory matches the helper column.
=COUNTIF(helpercolumn, dateOfInventory)
this then counts how many deliveries were made in the month of that inventory's month.
I use Tableau to do some report and my data source is excel live. I have an excel file that contains each selling records and it looks like this. the last two columns are year over year growth.
I want to hide the column highlighted in blue:
, without hiding any other column. Right now whenever I hide the highlighted column, the first column "2014 amount" also hides, but I want 2014 amount to display.
I know if I have quarters and months, there's a function to make the columns independent by combine year and quarter/month, but I only want the year. I know I can do it in two separated worksheet and put them together in one dashboard but I need to put them in one worksheet.
I tried to create a calculation field to calculate year 2015 year over year growth only, but I am not sure how to write the syntax. The logic would be:
Dim a,b,c, a = 2014 amount, b = 2015 amount, c = b/a-1
But I am not sure how to use tableau to do things like this.
You will have to remove the YEAR(Date) Dimension, and create 3 measures: one for 2014 sales, one for 2015 sales, and one with the delta. Otherwise, what you are trying to do will not work.
Thankfully, this is easy enough to do.
Create a measure for 2014 sales
SUM(CASE YEAR(DATE) WHEN 2014 THEN [Amount] ELSE 0 END)
Then a measure for 2015 sales
SUM(CASE YEAR(DATE) WHEN 2015 THEN [Amount] ELSE 0 END)
Then a delta measure
([2015 Amount] - [2014 Amount]) / [2014 Amount]
Then go ahead and drag them into your visual. Here's the result
I'm trying to fix up a formula I have that's having some issues. It's supposed to track # days invoiced in a month, so the high-level idea is to take the maximum date in a month and subtract the minimum date in the month, and on error subtract the 1st day of the month. My current formula has issues adjust for invoices that may cross months, an example being 1/25 - 2/3 where if this were the only invoice, January should show 7 days invoiced and February would show 3. If there were another invoice from 2/15 - 2/28, I would want Feb to show the maxed invoice days, 14 in this example.
For reference here's what a table could look like:
A B C D E F
start month end month invoice begin invoice end Month Max Days invoiced
jan 1 feb 1 1/25/14 2/3/14 1/1 7
feb 1 feb 1 2/15/14 2/28/14 2/1 14
3/1
etc.........
I tried the formula below but it was erroring out, plus I don't think it will account for gaps in invoices like in my example.:
=IF(B2:B100=X1,MAX(D2:D100),) - IF(A2:A100=X2,MIN(C2:C100),A2)
'where column X is a list of months, X1 = 1/1, X2 = 2/1, etc.
No luck with this formula either, keeps erroring out and giving 0 values:
{=DATEDIF(IF(A2:A100=E2,MIN(C2:C100),),IF(B2:B100=E2,MAX(D2:D100),),"d")}
I appreciate your help!
Not sure exactly what you are looking for but you could probably make use of the EOMONTH() function. Here's an example of it:
=EOMONTH(A2,0)-A2+1
by the way - here is how you would get the start of the month:
=EOMONTH(TODAY(),-1)+1
Try the following per your comment below:
"I think this could be useful but I'm not sure it would work if the invoice end was, say, 2/21 or anytime before the EOM"
=IF(B3>=EOMONTH(A3,0),EOMONTH(A3,0)-A3+1,B3-A3+1)