Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to create a combination chart with bars and Line. Bars being current rolling 12 months and line being Sameperiod last month. Everything working fine when I use dates in Xaxis. However my current requirement would be dislay both rolling and sameperiodlastYear based on category in X axis rather date. Please help if this is feasible. I try to create separate measures but not getting result as expected. Below screen capture which I am trying to achieve and sample data. Would like to display categories in Xaxis, rolling 12 months on bars and sameperiodlast year on bars.
Order ID | Order Date | Category |
CA-2017-126221 | 12/30/2021 | Ship Mode |
CA-2017-143259 | 12/30/2021 | Standard Class |
CA-2017-119305 | 11/30/2021 | First Class |
CA-2017-116645 | 11/30/2021 | Second Class |
CA-2017-104136 | 11/1/2021 | Same Day |
CA-2017-104136 | 11/1/2021 | Ship Mode |
CA-2017-131632 | 10/31/2021 | Standard Class |
CA-2017-117114 | 10/31/2021 | First Class |
CA-2017-117114 | 10/31/2021 | Second Class |
CA-2017-128041 | 9/1/2021 | Same Day |
CA-2017-128041 | 9/1/2021 | Ship Mode |
CA-2017-159884 | 8/31/2021 | Standard Class |
CA-2017-159884 | 8/31/2021 | First Class |
US-2017-148362 | 7/1/2021 | Second Class |
US-2017-148362 | 7/1/2021 | Same Day |
US-2017-148362 | 7/1/2021 | Ship Mode |
CA-2017-102946 | 6/30/2021 | Standard Class |
US-2017-102890 | 6/30/2021 | First Class |
CA-2017-131695 | 6/30/2021 | Second Class |
CA-2017-110198 | 5/1/2021 | Same Day |
CA-2017-110198 | 5/1/2021 | Ship Mode |
CA-2017-151911 | 4/30/2021 | Standard Class |
CA-2017-144526 | 4/30/2021 | First Class |
CA-2017-144526 | 4/30/2021 | Second Class |
CA-2017-155712 | 3/2/2021 | Same Day |
CA-2017-124114 | 3/2/2021 | Ship Mode |
CA-2017-101959 | 2/28/2021 | Standard Class |
CA-2017-101959 | 2/28/2021 | First Class |
CA-2017-117212 | 2/26/2021 | Second Class |
CA-2017-151750 | 1/1/2021 | Same Day |
CA-2017-151750 | 1/1/2021 | Ship Mode |
CA-2017-160395 | 12/31/2020 | Standard Class |
CA-2017-160395 | 12/31/2020 | First Class |
CA-2017-100202 | 12/31/2020 | Second Class |
CA-2016-100671 | 11/1/2020 | Same Day |
CA-2016-129196 | 11/1/2020 | Ship Mode |
CA-2016-119165 | 10/31/2020 | Standard Class |
CA-2016-144218 | 10/31/2020 | First Class |
US-2016-142251 | 10/31/2020 | Second Class |
CA-2016-140130 | 10/31/2020 | Same Day |
CA-2016-116526 | 9/1/2020 | Ship Mode |
CA-2016-116526 | 9/1/2020 | Standard Class |
CA-2016-124583 | 9/1/2020 | First Class |
CA-2016-117408 | 8/31/2020 | Second Class |
US-2016-141544 | 8/30/2020 | Same Day |
US-2016-141544 | 8/30/2020 | Ship Mode |
US-2016-126431 | 7/1/2020 | Standard Class |
US-2016-158680 | 7/1/2020 | First Class |
CA-2016-162355 | 6/30/2020 | Second Class |
CA-2016-162355 | 6/30/2020 | Same Day |
CA-2016-135594 | 6/30/2020 | Ship Mode |
CA-2016-101525 | 5/1/2020 | Standard Class |
CA-2016-154788 | 4/30/2020 | First Class |
US-2016-120460 | 4/30/2020 | Second Class |
US-2016-151862 | 3/1/2020 | Same Day |
CA-2016-111283 | 2/29/2020 | Ship Mode |
CA-2016-101623 | 2/28/2020 | Standard Class |
CA-2016-102456 | 2/27/2020 | First Class |
CA-2016-101448 | 2/27/2020 | Second Class |
CA-2016-128706 | 2/27/2020 | Same Day |
CA-2016-153661 | 1/30/2020 | Ship Mode |
US-2016-166660 | 1/30/2020 | Standard Class |
US-2016-166660 | 1/30/2020 | First Class |
CA-2016-114944 | 1/30/2020 | Second Class |
CA-2016-168032 | 1/30/2020 | Same Day |
CA-2015-110814 | 12/5/2019 | Ship Mode |
CA-2015-110814 | 12/5/2019 | Standard Class |
CA-2015-149566 | 12/5/2019 | First Class |
CA-2015-149566 | 12/5/2019 | Second Class |
CA-2015-141740 | 11/1/2019 | Same Day |
CA-2015-131457 | 10/31/2019 | Ship Mode |
CA-2015-122259 | 10/31/2019 | Standard Class |
CA-2015-162537 | 10/28/2019 | First Class |
CA-2015-162537 | 10/28/2019 | Second Class |
CA-2015-162537 | 10/28/2019 | Same Day |
CA-2015-139290 | 10/26/2019 | Ship Mode |
CA-2015-156146 | 10/26/2019 | Standard Class |
CA-2015-156146 | 10/26/2019 | First Class |
CA-2015-156566 | 10/1/2019 | Second Class |
CA-2015-169201 | 9/28/2019 | Same Day |
CA-2015-169201 | 9/28/2019 | Ship Mode |
CA-2015-104626 | 9/1/2019 | Standard Class |
CA-2015-104626 | 9/1/2019 | First Class |
CA-2015-112319 | 8/31/2019 | Second Class |
CA-2015-111514 | 8/31/2019 | Same Day |
CA-2015-111514 | 8/31/2019 | Ship Mode |
CA-2015-153388 | 8/1/2019 | Standard Class |
CA-2015-153388 | 8/1/2019 | First Class |
CA-2015-124891 | 7/31/2019 | Second Class |
CA-2015-124891 | 7/31/2019 | Same Day |
CA-2015-124891 | 7/31/2019 | Ship Mode |
CA-2015-128860 | 6/29/2019 | Standard Class |
US-2015-141684 | 6/29/2019 | First Class |
CA-2015-165799 | 6/29/2019 | Second Class |
US-2015-100069 | 6/29/2019 | Same Day |
CA-2015-124919 | 5/31/2019 | Ship Mode |
CA-2015-124919 | 5/31/2019 | Standard Class |
CA-2015-124919 | 5/31/2019 | First Class |
CA-2015-100818 | 5/31/2019 | Second Class |
CA-2015-100818 | 5/31/2019 | Same Day |
CA-2015-104486 | 5/1/2019 | Ship Mode |
CA-2015-104486 | 5/1/2019 | Standard Class |
US-2015-164175 | 4/30/2019 | First Class |
CA-2015-135174 | 4/30/2019 | Second Class |
CA-2015-103716 | 4/30/2019 | Same Day |
CA-2015-103716 | 4/30/2019 | Ship Mode |
CA-2015-128125 | 3/31/2019 | Standard Class |
CA-2015-133494 | 3/1/2019 | First Class |
CA-2015-133585 | 3/1/2019 | Second Class |
CA-2015-133585 | 3/1/2019 | Same Day |
CA-2015-104052 | 3/1/2019 | Same Day |
Solved! Go to Solution.
Hi Winniz, I was able figure out alternative, calculating max and minimum dates considering Today(), so it always give meset of months. I refer your calculation and updated it a bit and it is working as expected. Appreciate for help.
Krishna.
Hi @Anonymous ,
Try the measures like this:
Bar =
CALCULATE(
DISTINCTCOUNT('Table'[Order ID]),
FILTER(
'Table',
'Table'[Order Date] > EOMONTH( MAXX( ALL('Table'), 'Table'[Order Date] ), -12 )
)
)
Line =
var Max_Date = EOMONTH( MAXX( ALL('Table'), 'Table'[Order Date] ), -12 )
var Min_Date = EOMONTH( Max_Date, -12 )
return
CALCULATE(
DISTINCTCOUNT('Table'[Order ID]),
FILTER(
'Table',
'Table'[Order Date] > Min_Date
&& 'Table'[Order Date] <= Max_Date
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Winniz,
Thanks for the details, I try to replicate the same how ever in my actual data frame there was a gap in data feed (having said couple of months data is not loaded) and maxdata picking date differently. We must have data for all months to get this calculation work as expected. Please advise.
Thanks,
Krishna.
Hi @Anonymous ,
I randomly deleted several months of data, and after testing, I found that the formula still returned the correct result.
Do you only want to roll back 12 months with data? for example, the latest date is 2020-12-31 and there is no data in October 2020, then the data from 2019-12-01 to 2020-12-31 will be calculated.
Could you please share more error information (e.g. screenshots or PBIX files) ?
Best Regards,
Winniz
Yes, we want to roll back 12 month only even if there is data or not for couple of months in between.
Thanks,
Krishna.
Hi @Anonymous ,
Not clear. Could you please share more information?
What is the difference between the calculation results when there are all months and partial months?
@Anonymous wrote:
how ever in my actual data frame there was a gap in data feed (having said couple of months data is not loaded) and maxdata picking date differently. We must have data for all months to get this calculation work as expected.
What is your model? Could you please share your PBIX file without sensitive date?
Best Regards,
Winniz
Hi Winniz, I was able figure out alternative, calculating max and minimum dates considering Today(), so it always give meset of months. I refer your calculation and updated it a bit and it is working as expected. Appreciate for help.
Krishna.
Hi @Anonymous ,
If it has solved, could you please mark your reply as the solution to help the other members find it more quickly?
Best Regards,
Winniz
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |