I have a "sales" table containing all sales data and created a measure:
Total Sales = SUM(std_adi[Nettopreis])
this works fine in power pivot.
Now I want a DATESYTD() measure and used:
Total Sales YTD = CALCULATE([Total Sales], DATESYTD(Dates[Date]))
but when I add this into the power pivot sheet, it contains "no value"
My "Dates" table has a column "Date" and has a relationship to the std_adi table, column order_date (which contains my sales data)
Am I missing something? I have the above DATESYTD formula from a book and looks identical to all the examples on the net
Even if I change the measure to:
=CALCULATE(SUM(std_adi[Nettopreis]), DATESYTD(Dates[Date]))
it contains "no value" which leads me to the point that something with the Dates Table might be wrong, but I can't find anything
It won't have a value unless you slice / filter your pivot by year.
If it still doesn't work check that your Dates table is marked as a Date table. Check that you have a date for every day in the timeframe you are looking at. And check that you can slice your Total Sales measure by Year from your Date table.
Your formula is fine.
Related
I have a pivot table with the rows: Product and **Date ** (which shows the months) and values of: Sum of Starting, Sum of InTransit, Sum of Ending, all show inventory levels.
In the inventory report that I receive monthly, the Starting value is incorrect since it doesn't include the inventory which is InTransit. I would like to create a calculated field which will show the true inventory levels, it should add the Sum of InTransit value of the previous month to the current month Sum of Starting value. Another calculated field for the true end of month inventory, should sum the Sum of InTransit + Sum of Ending of the current month, but this is quite straightforward. I tried the function previousmonth, OFFSET, none seems to work.
Would truly appreciate your help!
Thanks!
Pivot Table
Pivot Table Fields
These are the individual data points of the data model:
These are the monthly salaries of the employees (obtained using the pivot table from the data model's data):
Each cell will then be used as the Lookup value which will be run through a table.
The lookup value is to be looked up in column A and column B of the table below and if it is matched (within the range), it will return the corresponding value under column C.
I am unable to find any index and match or vlookup functions in the power pivot functionality of excel using measures--which are used to get some analytics on aggregated values on report objects such as pivot tables.
I have found LOOKUPVALUE( <result_columnName>, <search_columnName>, <search_value>[, <search_columnName>, <search_value>]…) which is a DAX function however, the issue here is that I am doing a range lookup and as shown below, I don't know if you can have an array as an argument to the function.
Traditional calculated fields also do not allow arrays in the formulas.
Lookupvalue() only works on a single column lookups because it will return an empty cell if it cannot find a match as shown below:
But when it does find a match using the table below:
It will work just fine:
First, you need to create a measure for Pay:
Total Pay = SUM(Table1[Pay])
It's important to do it as a measure instead of just dropping 'Pay' into a pivot table (this is called an 'implicit measure' and is concidered a bad practice).
Then, let's say your table with pay ranges is named "Pay Ranges". Create another measure:
Returned Value =
CALCULATE(
VALUES('Pay Ranges'[Value To Return]),
FILTER( 'Pay Ranges',
[Total Pay] >= 'Pay Ranges'[Lower Bound] &&
[Total Pay] < 'Pay Ranges'[Upper Bound]
))
Make sure that all these formulas are Measures, not calculated columns.
Also, the formula relies on the correct construction of the ranges. If they overlap, you will get an error.
My Fact table "Premiums" has Premium value and DateTime column (EffectiveDate).
If I look at the Premium by MONTH(EffectiveDate) - it looks correct. Sorry, its not sorted.
But then if I create table Dates, join it to Premiums table on EffectiveDate column and try to look at Premiums by Month - it looks completely different.
I tried two different ways to create Calendar table. Still the same incorrect values.
What am I doing wrong?
It looks to me like you are trying to match a datetime (Premiums[EffectiveDate]) to a date (Dates[Date]), so it's not matching most of your rows.
Try adding a calculated column to your Premiums table that converts EffectiveDate to a date type and then match that up with your calendar table. The following are a few ways that should work for your calculated column:
Calculated Column = Premiums[EffectiveDate].[Date]
Calculated Column = EDATE(Premiums[EffectiveDate],0)
Calculated Column = ROUNDDOWN(Premiums[EffectiveDate],0)
Calculated Column = DATE(YEAR(Premiums[EffectiveDate]),MONTH(Premiums[EffectiveDate]),DAY(Premiums[EffectiveDate]))
Calculated Column = DATEVALUE(FORMAT(Premiums[EffectiveDate],"yyyy/mm/dd"))
Edit: If you don't need the time part of the EffectiveDate column for anything, then just convert both that column and the calendar date column to date types, and it should match up.
I'm trying to create a report that shows the current supply of incidents per week. I've got a table "Processing" with 5 columns:
"Year", "Week", "Created", "Closed" and "Supply"
The calculation I need to use is "Created"-"Closed" + "Supply" from the week before (the cell above). In a normal excel table this is easy enough but I can't figure this out with DAX.
To resolve your problem you have to create a index colum on your model. To create the index i create before a yearweek colum, with this calculate column formula:
=[Year]*100+[week]
After that i have create a Index Column with this calculate column formula:
=CALCULATE(COUNT(Tabella1[week]), ALL(tabella1), FILTER(Tabella1;[Yearweek]<=EARLIER([Yearweek])))
the result is this on powerpivot:
after that cou create a calculate column, with this formula:
= [created]+[closed]+LOOKUPVALUE([supply];[Index];[Index]-1)
the result is this:
I have data with the entities date, name, price. I managed to get distinct categories in the Categories colume for each name with = LEFT(B2;FIND(" ";B2)). In fact I want to get for each categorie the summed up monthly prices per month.
My sheet:
I tried:
=SUMIF(B2:B6;LEFT(B2;FIND(" ";B2));C2:C6)
However, this formula returns 0 and also does not give me the prices per categorie and per month.
I really appreciate your help!!!
If you want a sum on each row which will sum for the category of the current row and the month of the current row you can use SUMIFS like this
=SUMIFS(C:C;E:E;E2;A:A;">"&EOMONTH(A2;-1);A:A;"<="&EOMONTH(A2;0))
SUMIFS requires Excel 2007 or later
=SUMIF(E:E,E2,C:C) will sum the categories for you
I think if you want to sum categories by date, you might want to use a Pivot Table or write a Macro
You can write a =sumif function with multiple criteria but I'm not sure how you would define the "date rage" for each new criteria