Forum Discussion
Total in bar graph and table is wrong
Guys,
I have an issue with one customer. The problem is in a graph; I have 3 columns with sales from previous year, Sales and Sales target. Everything seems to be fine when I configure it up the previoud date (here is My 12th).
The issue is when I configure the date slicer to the last date (in this case May 13th), the value for previous year sales jumps from the day’s one $1,318,161.32 (May 12th) to the monthly one $5,564,885.04. In the table is possible to see that the sales for 13th are for $413,335.14, so the result is not correct. The bar is the month’s total instead of the daily’s one.
If I get a table with the daily sales, there is an incongruence with the results (left Power BI vs right excel):
The sum is $5,564,885.04 vs $1,731,496.46 (correct one). As a reference, this is the DAX I’m using to calculate the previous year sales:
_Ventas año anterior = CALCULATE(SUM(Comercializar[Venta]), DATEADD(Fecha[Fecha], -1, YEAR))
It seems there is a bug, right? Any suggestion to solve it?
Thanks a lot, regards,
Abelardo
Try this measure:
Previous Year = SUMX ( 'Fecha table', CALCULATE ( [Sum Venta], DATEADD ( 'Fecha table'[Date], -1, YEAR ) ) )
11 Replies
- PaulDBrownCommunity Champion
Does the 'Fecha' table contain continuous dates covering the whole range of dates in the model?
- AbevannHelper III
Correct, Fecha is continuos and based in the table formula:
Fecha = CALENDAR(MIN(Comercializar[DocDate]), MAX(Comercializar[DocDate]))And choosing the "Show items with no data" option, it shows empty spaces for 1, 2 and so on and so forth...:- PaulDBrownCommunity Champion
It looks like you are using fields from an automatic date hierarchy. You should be using the fields from the Fecha table (which btw you should mark as the date table if you haven't)
- AbevannHelper III
OK, I'll do it and let you know, thanks