Power BI datediff dax Usage with Example| How to calculate difference between two dates in power bi

Опубликовано: 12 Октябрь 2024
на канале: PowerBI Zone
6,410
32

#powerbi_training #powerbidax #dax #powerbi
In todays video we take a look at the datediff dax function in Power BI. It's used to calculate the difference between two dates in Power BI. The syntax for datediff Dax function is : DATEDIFF(Date1, Date2, Interval).
Explanation:
Date1 is a scalar datetime value.
Date2 is also a scalar datetime value.
The Interval is used when comparing dates. The value can be one of the following:
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
QUARTER
YEAR
Return value: The count of interval boundaries between two dates.
This is a common task that you'll need to do when working with data in power bi.
I'll give you an example to show you how to do the calculation, and then I'll explain the steps involved in more detail. After watching this video, you'll be able to calculate the difference between two dates in power bi easily and quickly!

We will also see the usage of datediff dax function in terms of column and measure .
The below are the actual dax written for the column and measure :
1.Usage of datediff as Column in power bi :
Time to Ship =
DATEDIFF(FactInternetSales[OrderDate],FactInternetSales[ShipDate],DAY)

2.Usage of datediff as measure in power bi :
Avg Time to Ship =
AVERAGEX(FactInternetSales,
DATEDIFF(FactInternetSales[OrderDate],FactInternetSales[ShipDate],DAY)
)
Check out our other Power BI Tutorials Videos :
1.SamePeriodLastYear with Example:    • difference between parallelperiod and...  
2.How to Calculate Running Totals:    • How to calculate running total in pow...  
3.Duplicate Vs Reference :    • power bi difference between duplicate...  
4.Merge Vs Append:    • power bi difference between merge and...  
5.Calculate Function in DAX Power BI:    • What is Calculate Function in Power B...  
6.Filter Function in Power BI:    • Filter Function in Power BI DAX  
7.Row Vs Filter Context:    • Row Context Vs Filter Context in Powe...  
8.ALL DAX Function:    • How to use ALL Dax Function in Power ...  
9.ALL Vs ALLSELECTED :    • allselected dax|all vs allselected da...  
10.ALL Vs ALLSELECTED VS ALLEXCEPT :    • All Vs AllSelected Vs AllExcept | Pow...  
11.ALL Vs REMOVEFILTERS :    • ALL Vs REMOVEFILTERS Difference in Po...  
12.TOPN Dax Usage :    • TOPN Dax | How to use topn dax in pow...  
13.Summarize Dax Function in Power BI:    • summarize dax | How to use summarize ...  
14.Summarize Vs Summarizecolumn :   • summarize vs summarizecolumns | how t...  
15.Calendar Vs CalendarAuto :    • Calendar Vs Calendar Auto Dax Functio...  
16.How to create a date table in Power BI :    • how to create a date table in power b...  
17.How to calculate Running total for date values in Power BI
   • How to calculate Running total for da...  
18.How to calculate running total in power bi for non date values:    • Running Total in Power BI for non dat...  

Learn Power BI through our vlog and Free Videos:
https://powerbizone.com/category/arti...

You can download the pbix file for your self practice sessions from :
https://drive.google.com/file/d/137TL...
Do not forget to Like ,Subscribe and comment which keeps me motivated !