Adding Calculated Field to find percentage and Labeling each calculation % - excel-2007

I would like to add below formula to my calculate field on the pivot table that will show the value to either "Yay" or "Nay" if the result is less than 5%
here is the formula =IFERROR(IF(AND(Orignial Qty<>0, (1-(Original Qty/Revised Qty))>0.05), "Yay", "Nay"), " - ")
here is the table
Month Original Qty Revised Qty
Jan 10.25 8.25
Feb 11.25 12.25
Mar 9.25 9.25

You mentioned using a pivot table... Are the original and revised qty's calculated values based on sums by the pivot table or is what you presented as the raw data or the result of the pivot? I'm a bit confused.
Fundamentally I think you want to add a computed column to the results based on the grouping the pivot does. I don't think you can directly do this. You either have to add a formula based on the pivot, but then the formula is static and results don't change if you add filter/pivot data.

Related

IIF statement is showing a 0 where I know there is a value

I have a dataset with values that I'm am trying to put into an SSRS report. Here is some example data:
Fund#
last week amount
YTD Total
1
$100
$1500
2
$0
$300
3
$500
$500
4
$0
$0
The first column in my SSRS report is a fixed list of fund names in the certain order that I want them to appear and I want to insert the amounts from the dataset into the row with the corresponding fund name and into the right column.
I tried to get the amount for Fund 1 from last week ($100) to appear in the report using the following expression:
=iif(Fields!fund_no.Value=1,fields!last_wk_amt.Value,0)
However, this is returning a 0 value but I know it should read 100. This seems pretty simple, but I just can't figure it out what I'm doing wrong.
Thanks for the help.
It sounds like your field is an aggregate of the dataset. The IIF statement works on a ROW basis. In your expression, it finds the first row (which is apparently not 1) and returns the evaluation.
I believe it would work correctly if you SUM the IIF:
=SUM(IIF(Fields!fund_no.Value = 1, Fields!last_wk_amt.Value, 0))
If your AMT field is not a decimal value, you'd need to convert the zero to a decimal to avoid an error about aggregating mixed data types:
=SUM(IIF(Fields!fund_no.Value = 1, Fields!last_wk_amt.Value, CDEC(0)))

Power pivot ytd calculation

Ok, I have watched many videos and read all sorts and I think I am nearly there, but must be missing something. In the data model I am trying to add the ytd calc to my product_table. I don't have unique dates in the product_table in column a and also they are weekly dates. I have all data for 2018 for each week of this year in set rows of 20, incrementing by one week every 20 rows. E.g. rows 1-20 are 01/01/2018, rows 21-40 are 07/01/2018, and so on.
Whilst I say they are in set rows of 20, this is an example. Some weeks there are more or less than 20 so I can't use the row count function-
Between columns c and h I have a bunch of other categories such as customer age, country etc. so there isn't a unique identifier. Do I need one for this to work? Column i is the sales column with the numbers. What I would like is a new column which gives me a ytd number for each row of data which all has unique criteria between a and h. Week 1 ytd is not going to be any different. For the next 20 rows I want it to add week1 sales to week2 sales, effectively giving me the ytd.
I could sumproduct this easily in the data set but I don't want do that. I want to use dax to save space etc..
I have a date_table which does have unique dates in the main_date column. All my date columns are formatted as date in the data model.
I have tried:
=calculate(products[sales],datesytd(date_table[main_date]))
This simply replicates the numbers in the sales column, not giving me an ytd as required. I also tried
=calculate(sum(products[sales]) ,datesytd(date_table[main_date]))
I don't know if what I am trying to do is possible. All the youtube clips don't seem to have the same issues I am having but I think they have unique dates in their data sets.
Id love to upload the data but its work stuff on a work computer so cant really. Hope I've painted the picture quite clearly.
Resolved, after googling sumif dax, mike honey had a response that i have adapted to get what i need. I needed to add the filter and earlier functions to my equarion and it ended up like this
Calculate (sum(products[sales]),
filter (sales, sales[we_date] <=earlier(sales[we_date]),
filter (sales, sales[year] =earlier(sales[year]),
filter (sales, sales[customer] =earlier(sales[customer]))
There are three other filter sections i had to add, but this now gives me the ytd i needed.
Hope this helps anyone else

Spotfire Running Balance (Cumulative Sum)

I am trying to create a running balance column in Spotfire that's supposed to look like the picture attached below. In essence,I want to calculate the cumulative total of the "amount" column row by row, and that I want it to start from 0 as the date changes.
I have tried several OVER functions:
Sum([AMOUNT]) OVER AllPrevious([Date])
Sum([AMOUNT]) OVER Intersect([CURRENCY],AllPrevious([SETTLEDATE]))
Sum([AMOUNT]) OVER Intersect([Calculation Date],AllPrevious([SETTLEDATE]))
Any help is greatly appreciated.
You were very close with your first over statement. The problem is, when you use over (AllPrevious([Date])) and you don't have 1 row for each date, then you will skip rows. So, the last row of your data would only sum it over the rows where 6/1/2017 is in the Date column. Instead, we need to apply a RowID to your data set and then sum over it. This will ensure we sum over all previous rows.
Assuming your data set is in the order you want it to be in when you bring it into SpotFire, do the following:
Insert a calculated column RowID() and name it RowID
Use this calculation: Sum([amount]) over (Intersect([Date],AllPrevious([RowID])))
This will give you the running sum you are looking for.
#scsimon- I modified your custom expression slightly to include date as requested in the question.
Modified expression:
Sum([Amt]) over (intersect(Allprevious([rowID]),[Date]))
Final output table:
#LeoL - Hope this answers your question.

Sum Multiple Column MS Access Via Sql Query or VBA

Problem:I am trying to make a Inventory Management Database on Microsoft Access 2010, and since i needed records date wise my Table looks like follows
SKU 2016-03-16 2016-03-17 2016-03-18 ... Total
AAA 10 -5 15 ... 20
BBB 05 05 25 ... 35
CCC 06 -5 24 ... 25
This way i wanted to add records for each day, but i am unable to make a "Total" column which will total all the columns (Sum(Columns*))
I am aware of sum and groupby but that works across multiple rows i am looking for something which can do the same for column
Expected Solution: A way either by Sql Query or VBA to total all the columns for SKU AAA,BBB,CCC, if not possible to total in the same table then i am open to total the columns in a new table.
Such a table is normally result of pivoting summary data. Real data would look like:
SKU, Date, Quantity
...
Then probably you would want to create a PIVOT table using SKU for rows, Date for Columns and Quantity for data (default operation is SUM). It would have the row totals by default.
It may have been named crosstab, cross tab .. or so in Access 2010.
(you may want to do the pivoting in Excel)

SSRS Multiple Dates returned from Dataset, want to display 1 date per column

I apologize if this is a stupid question..as I am new to SSRS. I have a dataset that returns about 15 dates e.g
01/01/2013
01/05/2013
01/20/2013
01/25/2013
..etc
and I want to put each one of those dates in a new column next to itself like the following:
Day1 Day2 Day3 Day 5
01/01/2013 01/05/2013 01/20/2013 01/25/2013
any idea on how to do so? I would really appreciate the help
Build a table/matrix and create a column group that contains your date field. It will expand the dates out horizontally when it renders. Here is a link that contains instructions to add a column group to an existing table.
If you have fixed number of dates (15 in your case) then you can use pivot in SQL and let your dataset return dates in horizontal format (i.e 1 row with 15 columns) otherwise you can use column grouping to achieve this.
Thanks,
Neeraj