Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello got the below table in which I'm displaying the sales by Engineer per year
what I want now is to calculate per engineer per year the Margin(%) which is calculated as follows (pseudo code):
for 2010: (sales (2010) - sales(2009)) / sales(2009)
if the Sales measure is defined as follows:
Sales = CALCULATE(sum(Transactions[cSales]),Transactions[SDLNTY]="SA" || Transactions[SDLNTY]="RG" )
what would be the sales of previous year?
Please advise
PY Sales = CALCULATE ( [Sales], PREVIOUSYEAR(CalendarTable[Date])
YoY $ = [Sales] - [PY Sales]
YoY % = DIVIDE ( [YoY $], [PY Sales], 0)
Can I share with you the file I'm working on?
it didn't work for me the previous year sales; it is giving blanks
Do you have a Calendar Table?
If not visit @MattAllington's link - http://www.powerpivotpro.com/2015/02/create-a-custom-calendar-in-power-query/
Time Intelligence Functions require the presence of a Calendar Table
I created a calendar using first =List.Date and then converting the list to table and I added the parts of the dates (year, month, week, quarter ...)
but still it returns blank
Please advise
@alihijazi so you created a separate Calendar Table? Did you create a Relationship between the 2 tables?
@alihijazi If you have the Calendar table set up as described in Matt's link I provided above - evertything should work
I tried to make my sample data as close as possible to your example and I'm including the formulas again
Everything should work okay - don't you get anything to work at all?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
72 | |
55 | |
39 | |
39 |
User | Count |
---|---|
96 | |
62 | |
55 | |
49 | |
48 |