Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have a requirement that in line and stacked column chart i added the date field as x-axis and in bar chart added trailling 12 month sales and in line graph added trailing 12 month previous year sales.
Here the issue is i am getting different time frame for line and different time frame for bar chart as both are showing current year and previous year.
when i select the date from the slicer both are showing last 12 months data dynamically.
i need to show the previous year line on top of the bar.
as it is different time frames for current year and previous year i am getting this as seperate line and bar.
But i need to represent like above graph which shows current year vallues in line and previous year in bar
and it should change based on the month-year selected from the slicer.
here important thing is current year sales is calculated to represent like trailing 12 months and previous year sales is calculated for trailing 12 months with different time frame.
Here is the dax for current year
Solved! Go to Solution.
Hi @lakshmi_G ,
According to your description, I create a sample.
Here's my solution. Create a measure.
TTM_ThroughputsPY =
IF (
[TTM_Throughputs] = BLANK (),
BLANK (),
CALCULATE (
SUM ( 'Cokpit_Page1_TP'[ThroughputsID_PM] ),
SAMEPERIODLASTYEAR ( 'Cokpit_Page1_TP'[EndOfMonthDate] )
)
)
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lakshmi_G ,
According to your description, I create a sample.
Here's my solution. Create a measure.
TTM_ThroughputsPY =
IF (
[TTM_Throughputs] = BLANK (),
BLANK (),
CALCULATE (
SUM ( 'Cokpit_Page1_TP'[ThroughputsID_PM] ),
SAMEPERIODLASTYEAR ( 'Cokpit_Page1_TP'[EndOfMonthDate] )
)
)
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@lakshmi_G , Make sure you use date table joined with you table. In slicer and vsiaul use column from date table
a measure like example can help
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))
12 month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-12,Month))
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
89 | |
87 | |
81 | |
64 | |
49 |
User | Count |
---|---|
123 | |
109 | |
88 | |
68 | |
67 |