Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hello,
I want to do a date diff between datemoyenne of my colum valeursutilisé = B and datemoyenne of my colum valeursutilisé = A.
I need do it for each valeursutilisé.
We need to verify that if you want to calculate the date difference between the current row and previous row or the date difference between the current row and the first row(ValeusrUtilise=A).
Firstly, add an index column in your table in Query Editor.
Secondly, if you mean the first case, create the following columns in your table.
Previousrow = CALCULATE(FIRSTNONBLANK(Table[DateMoyenne],""),FILTER(Table,Table[Index]=EARLIER(Table[Index])-1))
Datediff = IF(Table[DateMoyenne]<=Table[Previousrow],DATEDIFF(Table[DateMoyenne],Table[Previousrow],DAY)*(-1),DATEDIFF(Table[Previousrow],Table[DateMoyenne],DAY))
If you mean the second case, create the following columns in your table.
first row = CALCULATE(FIRSTNONBLANK(Table[DateMoyenne],""),FILTER(Table,Table[Index]=1))
Datediff2 = IF(Table[DateMoyenne]<=Table[first row],DATEDIFF(Table[DateMoyenne],Table[first row],DAY)*(-1),DATEDIFF(Table[first row],Table[DateMoyenne],DAY))
Regards,
Lydia
@AlexGallet01,
Where do you store the sample data you post? Do you want to calculate date difference in Power BI Desktop?
Regards,
Lydia
The data that I have published are measurements and yes it is on power bi desktop
@AlexGallet01,
You may need to create a calculated table containing ValeusrUtilise, DateMoyenne and other fields, then create calculted column using the DAX I provide.
If you have any questions about creating calculated table, please share raw data of your table and post the DAX you use to create the above measures.
Regards,
Lydia
Hello,
As far as values are concerned, they are the values of a column of my table but for the date it is a measure.
DateMoyenne = FORMAT(average(TECHNIKE[TEST NON VIDE]);"YYYY-MM-DD")
Please help to post sample data of the TECHNIKE table.
Regards,
Lydia Zhang
@AlexGallet01,
I haven't seen the TEST NON VIDE column from the table you post. Could you please post complete columns with sample data that can be copied and pasted so that I can test?
Regards,
Lydia
Hello,
I'm again blocked have you got a solution please ?
@AlexGallet01,
Regarding to your last screenshot, do you raise a new requirement? Could you please explain your expected result? For the last screenshot, do you want to get difference of dates between each row?
And could you please share your PBIX file to me so that I can provide you appropriate DAX? You can upload PBIX file to OneDrive and send me the shared link via Private Message.
Regards,
Lydia
Hello,
If it's possible i want to do a date diff between all date by lign on my new board. And for my project.pbix, i can't to send this because he have a confidential data.
Reguards.
@AlexGallet01,
You can share dummy data of your table, and put the data in Excel file, then upload the Excel file to OneDrive and post shared link of the Excel file here.
Regards,
Lydia
Hello,
If it's possible i want to do a date diff between all date by lign on my new board. And for my project.pbix, i can't to send this because he have a confidential data.
Reguards.
And with this table it's possible to do a datediff between all date of the month ???
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
| User | Count |
|---|---|
| 50 | |
| 43 | |
| 36 | |
| 33 | |
| 30 |
| User | Count |
|---|---|
| 138 | |
| 125 | |
| 60 | |
| 59 | |
| 56 |