Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have some KPIs like market share and basis point change that I want to display in the line and stacked column chart. I want the column chart to only display the last twelve month data from the selected month and year from a slicer. I know the chart is not designed to work this way, but I made some changes and got the columns to display the brand share for only the last twelve months even though my tables have data for the last 3 years. I want the line to display the basis point change but when I put my measure in "Line y-axis" option it display all the past data.
This is one of the measure which displays the brand market share as columns correctly:
last_12_months_market_share =
VAR selectedDate = MAX('Calendar'[Date])
VAR previousDates = DATESINPERIOD(presentation_calendar[Date], selectedDate, -11, MONTH)
VAR Result =
CALCULATE(
(CALCULATE(SUM(Sales[Dollars])))
/
(CALCULATE(SUM(Sales[Dollars]),
ALL(Brands[Brand]))),
REMOVEFILTERS('Calendar'),
KEEPFILTERS(previousDates),
USERELATIONSHIP('Calendar'[Date], presentation_calendar[Date])
)
RETURN
Result
This is other measure I wrote but it not working correctly:
test_2 =
VAR selectedDate = MAX('Calendar'[Date])
VAR previousDates = DATESINPERIOD(presentation_calendar[Date], selectedDate, -11, MONTH)
VAR Result = CALCULATE(
(((CALCULATE(SUM(Sales[Dollars])))/
(CALCULATE(SUM(Sales[Dollars]),ALL(Brands[Brand]))))
-
((CALCULATE(SUM(Sales[Dollars]),
SAMEPERIODLASTYEAR(datesbetween('Calendar'[Date],
edate(MIN(calendar[Date]),-[selected_end_scale_value]),MAX('Calendar'[Date])))))
/
(CALCULATE(SUM(Sales[Dollars]),
ALL(Brands[Brand]),
SAMEPERIODLASTYEAR(datesbetween('Calendar'[Date],
edate(MIN(calendar[Date]),-[selected_end_scale_value]),MAX('Calendar'[Date])))))))
*1000
,
REMOVEFILTERS('Calendar'),
KEEPFILTERS(previousDates),
USERELATIONSHIP('Calendar'[Date], presentation_calendar[Date])
)
RETURN
Result
This is how it is displayed correcly but when I add the second measure for the line I get the second image:
Any suggestions would be helpful.
Thanks.
Hi @Anonymous ,
As checked your second screenshot, it seems that you apply another measure in Line field for the visual. It should be the cause of problem... Compared with your first screenshot, there is no data before December, 2021. But it will display the data start from January 2019 when you add the measure in Line field...
In order to make troubleshooting and give you a sutiable solution, could you please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community.
How to upload PBI in Community
Best Regards
User | Count |
---|---|
117 | |
73 | |
58 | |
49 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |