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 need to take Aggregated Salary values for Previous year where Year Column is not Date column -
Employee_ID | Year | Month | Salary |
123 | 1 | 1 | 300 |
123 | 1 | 2 | 100 |
123 | 1 | 3 | 200 |
123 | 2 | 6 | 250 |
123 | 2 | 8 | 250 |
123 | 2 | 9 | 250 |
Output Expected -
Employee_ID | Year | Salary | Previous Year Salary |
123 | 1 | 600 | |
123 | 2 | 750 | 600 |
Hi @powerbi_2022 ,
In this visual, is the [Year] column in the same table as the [Salary] column (i.e. 'Table')? If it is in the same table then the formula of @jdbuchanan71 will return the correct value, if it is not in the same table then replace "Table" with the table where the [Year] column is located.
For example in my model, I need to use 'Date'[YearNum].
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.
It returns for me based on your sample data.
You could try it like this.
PY Salary =
VAR _Year = SELECTEDVALUE ('Table'[Year] )
RETURN
CALCULATE ( SUM ('Table'[Salary] ),'Table'[Year] = _Year - 1 )
Not returning any value.
@powerbi_2022
This thread may help you !https://blog.crossjoin.co.uk/2010/05/26/time-intelligence-without-date-columns-in-dax/
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 |
---|---|
107 | |
105 | |
88 | |
74 | |
66 |
User | Count |
---|---|
126 | |
111 | |
100 | |
83 | |
71 |