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.
Hello
I got transacions for the year 2015 from Jan till Dec
and for the year 2016 from Jan till Jun
I want to create KPIs and the users don't want to select / filter out anything
what I mean is that I want to create a line chart showing a line for YTD amount for 2016 vs YTD amount for 2015
for 2016 I created the following expression:
YTD Revenues = var maxYear = max(Master_Calendar[max_Year]) return CALCULATE(sum(view_operations[Amount]),view_account_categorization[Fiscal_Category_DescE]="Budget",view_account_categorization[Fiscal_Chapter_DescE]="Revenues",FILTER(all(Master_Calendar),Master_Calendar[Year]=maxYear && Master_Calendar[Date] <= max(Master_Calendar[Date])))
for 2015 I created the following expression
LYTD Revenues = CALCULATE([YTD Revenues],PREVIOUSYEAR(Master_Calendar[Date]))
However I get the following results which is not logical
Please advise
If you want to use PREVIOUSYEAR(Master_Calendar[Date]) in this scenario, you have to use a slicer to select current year so that PREVIOUSYEAR() will get correct current year to resolve.
But you mentioned that you don’t want the users to select / filter out anything. So you can try with the formulas provided by @kcantor and @Vvelarde. Both formulas should work here.
Regards,
You can also use "DATEADD" for your calculation.
CALCULATE([YTDREVENUES], DATEADD(Master_Calendar[Date],-1, year))
Proud to be a Super User!
hi; @alihijazi
try with this:
LYTD Revenues = CALCULATE([YTD Revenues],Sameperiodlastyear(Master_Calendar[Date]))
Please try with below formula of “LYTD Revenues”.
LYTD Revenues = CALCULATE ( [YTD Revenues], PREVIOUSYEAR ( FILTER ( VALUES ( Master_Calendar[Date] ), YEAR ( Master_Calendar[Date] ) = MAX ( Master_Calendar[max_Year] ) ) ) )
I would recommend combining a Year-Month column and using two years worth of data instead of a single year. Filter for sales data for 2015 and 2015 in query editor. Add your year-month column to your date table to display as 2015-01, 2015-02 etc. Then use just YTD and use YearMonth on the axis.
Proud to be a Super User!
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 |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |