The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a slicer in a pbi page for date, I need to calculate the sales for the previous year of the selected period in the slicer not the sameperiodlastyear, for example if I select in the slicer from 01/01/2023 to 31/01/2023 it should calculate for all the year of 2022.
I have a dimension table for Dates and a fact table for Sales connected through SALES[Date] and DATES[Date]. The Dates table have the columns Year, Date and Month-Year.
The visual that I am using is a chart bar where the X-axis is month-year. How can I do the calculation only for the values of month-year of the previous year considering what I said at the beggining?
Maybe something like the following but I don't know how to filter DATES by DATES[YEAR] and only get the values of the previous year of DATES[monthYear] to pass to CALCULATE.
Total Net Value =
VAR previousYear = MAX(DATES[Year])
VAR monthYearValuesPreviousYear = VALUES(......)????
RETURN
CALCULATE(
SUM(SALES[netValue]),
DATES[monthYear] IN monthYearValuesPreviousYear
)
Solved! Go to Solution.
Thank you for your reply, but my X-axis is month-year. I adapted the sample to show what I am trying to achieveModel
Design
Measure
User | Count |
---|---|
80 | |
74 | |
41 | |
30 | |
28 |
User | Count |
---|---|
107 | |
96 | |
53 | |
47 | |
47 |