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 everybody!
Today I noticed an error in a formula I thought was working correctly.
I need to count jobs done in the previous day (if today is 17/12 then i need 16/12) but I don't want to count the non working days and since my company operates on saturdays I need 15/12. I did an auxiliary calendar table with excel with the holidays of my region and sundays and did another column with "yes" or "no" to mark the days as "working day".
The formula I use is:
@Sorakell,
The first parameter in DATEADD function should be a column that contains dates.
Cantidad de vehiculos AYER = CALCULATE([Cantidad de vehiculos];DATEADD(Calendario[Date];-1;DAY))
Cantidad de vehiculos AYER = CALCULATE([Cantidad de vehiculos];DATEADD(Calendario[Date];-1;DAY);'Calendario FT'[es laborable?]="si")
If the above DAX don't help, please share sample data of your table and post expected result here.
Regards,
Lydia
Sorry, but i don't know how to share data.
If you don't mind to explain I could send the excel and .pbix file so anybody who would like to test it could try.
If not I will post some pics...
thanks for your interest.
These are the archives I use.
Only a PBIX file is contained in the above link.
Could you please explain what is your expected result based on the sample data? In your PBIX file, please use DATEADD function as below.
Regards,
Lydia
Thanks Lydia, but the formula you give me counts all the dates to yesterday thats why I use TODAY -1 because I need the value only of the previous day.
I have another post
in there I tried also to post the .pbix and the excel tables but the link doesn't work. In the last reply i try to recreate the process step by step and explaining the best i can what i'm expecting to get. If you don't mind to take a look there maybe it will be more easy.
Sorry,but i'm new in Power Bi and i'm new in this forums and i'm not even able to post a link to the post.
Thanks for your help and interest.
I am not very clear about what you mean by "I need the value only of the previous day". If you only want to get data of Today()-1, you can simply create the following measure.
CALCULATE([Cantidad de vehiculos]; filter('Calendar';'Calendar'[Date]=TODAY()-1))
Regards,
Lydia
Hi Lydia!
I meant that i only wanted the value of one date (only one day). In this case I need the previous working day, so I need to filter in another column to know if previous day was a working date or not.
the formula i use currently is that:
@Sorakell,
As my previous reply, the first parameter in DATEADD function should be a column that contains dates. It is not allowed to add Calendario[Date]=TODAY() as first parameter in the following DAX.
Cantidad de vehiculos AYER = CALCULATE([Cantidad de vehiculos];DATEADD(Calendario[Date]=TODAY();-1;DAY);'Calendario FT'[es laborable?]="si")
Please change the above DAX to the following and check if you get expected result.
Cantidad de vehiculos AYER = if(MAX(Calendario[Date])=TODAY();CALCULATE([Cantidad de vehiculos];DATEADD(Calendario[Date];-1;DAY);'Calendario FT'[es laborable?]="si"))
If you still have issues, please post expected result based on sample data following the guide in this blog below.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Regards,
Lydia
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |