Problems with Date Intelligence in Power Pivot (Excel 2013) - excel

I am working with a PowerPivot model where I want to add date intelligence formulas using DAX. I could build the formula and after checking it, Power Pivot says that are ok, nevertheless, the formulas are returning values that are not consistency with what I am expecting.
YTD Formula:
=CALCULATE(TOTALYTD(SUM(V_CONTABILIDAD_EstadosFinancieros[Saldo]),V_CONTABILIDAD_EstadosFinancieros[FinPeriodo]))
The error is that the value that is returning is the same value as Saldo, it means is not accumulating the amount over months.
Last Year Formula
=CALCULATE(SUM(V_CONTABILIDAD_EstadosFinancieros[Saldo]),DATEADD(V_CONTABILIDAD_EstadosFinancieros[InicioPeriodo],-1,YEAR))
The error is that is not giving me any value. The fields InicioPeriodo and FinPeriodo as marked as dates.
Please your advice if I need to check something additional in the model in order that these functions work.
Thanks in advance.

Ok, I resolved it.
It is not about using date tables in the formulas, it should be used in the pivot tables as well, as slicers and fields.
Here the details http://www.powerpivotpro.com/2013/01/calendar-tables-not-just-for-formulas-use-them-on-your-pivots-too/
Now is working beautifully.

Related

USERELATIONSHIP in CALCULATE function returning wrong results

I am new to DAX and Power Pivot, I apologize in advance if there is a similar thread I did not see. I am using Excel 2016, I need to use USERELATIONSHIP in the CALCULATE function to use an inactive relationship in the data model (I need it for a slicer).
I am using this formula =CALCULATE([Count of Fiscal Week Identified],USERELATIONSHIP(Table[Fiscal Week Identified],Week[Week])) to create a calculated field I need to add to a pivot table.
I just need Excel to generate the pivot table on the left in the screenshot using a calculated field inserted in values, and the field 'week' in rows (having an inactive relationship in the data model). When I tried using the formula above, I get the table on the right which is completely different from the table on the left, and I cannot figure out why... I need this to include the pivot table in a slicer. Any help would be very much appreciated. Thank you in advance!
Regards,
The problem is that even though you are creating column using USERELATIONSHIP, the relationship isn't active when this column is evaluated in Pivot Table. So you need to use a Measure. Is the below the expected result?
If yes, then create a measure like this:

Continuous Running total in Excel Power Pivot

I would like to display/calculate my running total in pivot table in excel until the next year without resetting every other year.
Any workaround ideas to achieve my desired outcome?
You can solve this issue partially by Un-grouping the date fields. It worked for me like that.
This still doesn't work for the grouped date fields.
Another turn around is to add field/s for the cumulative formula manually to the table, then show them in the pivot table while selecting "MAX" instead of "SUM" as the type of calculation.

New table values are not included in excel calculations

I have created a table in excel which contains information on licenses, and I have created a formula which adds the value of licenses purchased in the last 30 days. The following code seems to do the trick:
=SUMIF(LicenseList[Purchase date], ">="&(today()-30), LicenseList[EURvalue])
My only problem is, that when I add new data into my table, it is not included in the result!
This is just one calculation which doesn't work - it seems that all of the calculations which are referencing the particular table, are not getting updated (I have naturally tested that the added values indeed do become part of the table).
Crossing my fingers for some help! :)
Try the Ribbon menu item Formulas > Formula Auditing > Evaluate Formula. This allows you to see the result of each step in the formula. You can also check precedents and dependents.
Because the data was being populated into the table by a VBA script, the format was invisibly not a date. This was required for the column to be included in the formula, and even though excel told me that the whole column was set as dates, they clearly were not. By converting the values to dates using CDate() before inputting them to the table, the formula now works.

Calculating the Difference in Dates in Excel, and Pivot Tables

I'm trying to do the same thing(ish), as in another question, but I'm perplexed by the answer as it doesn't add up for me. It might help if you see this referenced question (Calculate difference from previous date in Excel pivot table). Why is it that in this solution example does the difference in dates show up as 43165 ("days"—I'm assuming)? My model is working to show days between subscription start dates and end dates. So it's should be pretty much the same thing.
Further more, I don't understand why it is when I do a date difference calculation inside the excel table that it works, but when I use it as a calculated field in a pivot table it doesn't work. This is the Formula I used. =ABS(MONTH(J2)-MONTH(D2))+1
I used Absolute because it was showing negatives. I added 1 month to account for the current month and because subs showing less than 30 days, would display 0(zero) months.
Thanks in advance,

GetPivotData with a filter

I want to use several GetPivotData functions, retrieving data from the same Pivot table. I want each of them to retrieve different data based on a filter value.
For instance:
Get Pivot Data for Month:January
Get Pivot Data for Month:February
Where Month is a filter on the Pivot. Is this possible using a formula?
I hope this will solve your problem. Try this workaround from Microsoft:
https://support.microsoft.com/en-us/help/287736/getpivotdata-formula-is-automatically-created-when-you-try-to-create-s
When you change the month, the value changes too. But make sure that there are no hidden items (because if not, you won't get an accurate #/data).
see the screenshot below where the Month to choose is based on a cell reference as an argument in the GETPIVOTDATA formula:
Victor,
The Pivot tables won't work like you intend to. All data that your formula shall retrieve must be visible at the same time. I suggest that you arrange for some space on your worksheet and apply the solution proposed by Scott.
NB: If you want to deal with data added month by month, for example, there is an Pivot table option to automatically add new values to the filter. Then in your formula you can use IFERROR to show blank cells when there is still no data available.
Regards,
+Daniel+

Resources