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.
HI
I Have a problem I am trying to figure out.
I am fairly new to Power BI.
I want to add a column that takes the value of the SMU for a machine name and calculates the difference between it and the last value recieved.
So in the end a column that adds a value for SMU that would be just 1 days worth
Solved! Go to Solution.
@bmacman , a new column
new column =
var _max = maxx(filter(Table, [Machine name] = earlier([Machine name]) && [ShiftDateTime] < earlier([ShiftDateTime] ) ),[ShiftDateTime] )
return
[SMU] - maxx(filter(Table, [Machine name] = earlier([Machine name]) && [ShiftDateTime] =_max ),[SMU] )
Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
This works great. but how can I calculate the difference between dates in the above example.
The first date should show 0
Hi , @bmacman
According to your description, you want to calculate the "Subtracting a column value on one date from the previous data date for a specific device". Right?
Here are the steps you can refer to :
(1)This is my test data:
(2)We can click "New Column" and enter:
Column = var _machine = [MACHINENAME]
var _date = [Date]
var _previous_date =MAXX( FILTER('Table', 'Table'[Date]<_date && 'Table'[MACHINENAME]=_machine) ,[Date])
var _pre_sum = SUMX( FILTER('Table','Table'[Date] = _previous_date) , [SUM])
return
[SUM]-_pre_sum
(3)Then we can get the data like this:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@bmacman , a new column
new column =
var _max = maxx(filter(Table, [Machine name] = earlier([Machine name]) && [ShiftDateTime] < earlier([ShiftDateTime] ) ),[ShiftDateTime] )
return
[SMU] - maxx(filter(Table, [Machine name] = earlier([Machine name]) && [ShiftDateTime] =_max ),[SMU] )
Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
Thanks that worked. Much aprreciated.
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 | |
79 | |
71 | |
66 |
User | Count |
---|---|
141 | |
107 | |
100 | |
82 | |
74 |