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'm stuck right now with a problem and i have a little guess why is not working but i dont know so much dax to solve it.
Some days ago i asked help with this https://community.powerbi.com/t5/Desktop/Set-value-to-the-day-after/m-p/919562 and it got solved, when i put the measure on a matrix with dates it works fine, BUT when i use card visualization, it doesnt show me the total when i got night shifts.this is for day shifts, it works fine, but you can see in Night shifts it doesnt add ( i know as the result should be the same, but the difference is much bigger than what i calculate) so i put filters on my data and I got the right values, and as far as I could see, it doesnt add me some values
this is the code
NightShift =
VAR PreviousDayDate = MAX(HistorialPorTaller[FechaBeginning]) -1
RETURN
SUM(HistorialPorTaller[TimeBefore24]) +
CALCULATE(SUM(HistorialPorTaller[TimeAfter24]); Calendar[Date] = PreviousDayDate)
Total Duration + Night = CALCULATE(SUM(HistorialPorTaller[TotalDuration]);HistorialPorTaller[DayShift]="NO")+[NightShift]
So as far as my knowledge let me think, when i use Total Duration + Night on the card It doesnt add me the TimeAfter24 but when I used it on a matrix it showed me the right values, so i dont know why that happen
Solved! Go to Solution.
In the Matrix each row is a date and [Total Duration +Nights] is calculated for each day, one by one - except for total row.
In the card there is only one date - day before the last day and this is what is shown. It should also be the same value as in your Matrix total row
If you want to have sum of all days you would need to use SUMX on all values per day, this would also work for single row
EDIT
I actually got another idea, try this (it also works for date ranges):
NightShift =
VAR __CurrentDayDate =
MAX ( HistorialPorTaller[FechaBeginning] )
RETURN
SUM ( HistorialPorTaller[TimeBefore24] )
+ CALCULATE (
SUM ( HistorialPorTaller[TimeAfter24] );
'Calendar'[Date] < __CurrentDayDate;
DATEADD ( 'Calendar'[Date]; -1; DAY )
)
In the Matrix each row is a date and [Total Duration +Nights] is calculated for each day, one by one - except for total row.
In the card there is only one date - day before the last day and this is what is shown. It should also be the same value as in your Matrix total row
If you want to have sum of all days you would need to use SUMX on all values per day, this would also work for single row
EDIT
I actually got another idea, try this (it also works for date ranges):
NightShift =
VAR __CurrentDayDate =
MAX ( HistorialPorTaller[FechaBeginning] )
RETURN
SUM ( HistorialPorTaller[TimeBefore24] )
+ CALCULATE (
SUM ( HistorialPorTaller[TimeAfter24] );
'Calendar'[Date] < __CurrentDayDate;
DATEADD ( 'Calendar'[Date]; -1; DAY )
)
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 |