Forum Discussion
Limiting dates in Line and Stacked Column Chart
Hi Anonymous ,
I don't know how you created that visual object, so I may not be able to give you a solution based on what you have first. But I can provide you with a workaround.
Here is my sample data:
And I add a Table X-axis for the x-axis of the visual:
Use these DAXs to create measures to calculate the previous 5 month and yesterday:
Yesterday =
CALCULATE(
SUM('Table'[Value]),
'Table'[Date] = TODAY() - 1
)previous month_1 =
CALCULATE(
SUM('Table'[Value]),
'Table'[Date] = EOMONTH(TODAY(), -1)
)previous month_2 =
CALCULATE(
SUM('Table'[Value]),
'Table'[Date] = EOMONTH(TODAY(), -2)
)previous month_3 =
CALCULATE(
SUM('Table'[Value]),
'Table'[Date] = EOMONTH(TODAY(), -3)
)previous month_4 =
CALCULATE(
SUM('Table'[Value]),
'Table'[Date] = EOMONTH(TODAY(), -4)
)previous month_5 =
CALCULATE(
SUM('Table'[Value]),
'Table'[Date] = EOMONTH(TODAY(), -5)
)
And use this DAX to create a measure for the Y-axis of the visual:
Y-axis =
SWITCH(
TRUE(),
SELECTEDVALUE('X-axis'[X-axis]) = "previous 5 month", [previous month_5],
SELECTEDVALUE('X-axis'[X-axis]) = "previous 4 month", [previous month_4],
SELECTEDVALUE('X-axis'[X-axis]) = "previous 3 month", [previous month_3],
SELECTEDVALUE('X-axis'[X-axis]) = "previous 2 month", [previous month_2],
SELECTEDVALUE('X-axis'[X-axis]) = "previous 1 month", [previous month_1],
SELECTEDVALUE('X-axis'[X-axis]) = "Yesterday", [Yesterday]
)
Then build the visual like this and the final output is as below:
If this solution does not solve your problem, could you please provide a bit of detail about how you created the visual object, such as the code you used and which fields were placed where in the visual object?
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.