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 everyone,
I'm having troubles trying to make a new measure in PowerBi. I have a column regarding of instantaneous energy production value and I'd like to make a counter of any daily stop.
This is the idea: if the value of N row is less than X AND the value of the previous row (N-1) is bigger than X, the measure must return "1"; instead, it will return "0".
I tried using COUNT formula without success.
Can you plase give me an hand?
Thank you!
Solved! Go to Solution.
Suppose the X is 20, you could create a calculate column using dax below:
Flag = VAR X = 20 VAR Current_Value = 'Table'[Value] VAR Previous_Index = 'Table'[Index] - 1 VAR Previous_Value = CALCULATE(MAX('Table'[Value]), FILTER('Table', 'Table'[Index] = Previous_Index)) RETURN IF(X > Current_Value && X < Previous_Value, 1, 0)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Suppose the X is 20, you could create a calculate column using dax below:
Flag = VAR X = 20 VAR Current_Value = 'Table'[Value] VAR Previous_Index = 'Table'[Index] - 1 VAR Previous_Value = CALCULATE(MAX('Table'[Value]), FILTER('Table', 'Table'[Index] = Previous_Index)) RETURN IF(X > Current_Value && X < Previous_Value, 1, 0)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
For the sake of this Demo, I would assume your X=50
Calculated Column:=
VAR PreviousRow = TOPN (1,FILTER ( Table1, Table1[Column1] < EARLIER ( Table1[Column1] ) && Table1[Column2] = EARLIER ( Table1[Column2] )), [Column1], DESC)
RETURN IF( AND(Table[ColumnA]>50,Table[ColumnB]>50),1,0)
Consider two columns from your table as [Column1] && [Column2].
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |