Friday, October 30, 2020

Day1 Dax Functions

What is dax ?

DAX stands for data analysis expressions

DAX is a collection of functions, operators, and constants that can be used in a formula, or expression, to calculate and return one or more values.

This some dax function all are same to excel pivot dax functions

Why use dax..?

Create reports that show valuable insights without using any dax formulas at all.

But

What if you need to analyze growth percentage across product categories and for different date ranges? Or you need to calculate  year –over-year growth compared to market trends? Dax formulas provide this capability and many other important capabilities as well.

Learning how to create effective dax formulas will help you get the most out of your data

When you get the information you need

Syntax

Lets take a look at dax formula syntax.

Syntax includes the various elements that make up a formula

How the formula is written.

For example let’s look at a simple dax formula for a measure

This formula includes the following syntax elements

Measure

You type your measure name in place

For example  :  I am created month total sales so I am entered measure name month total sales

=

The equals sign operator (=) indicates the beginning of the formula.

When calculated it will return a result

Sum

Sum is a one the dax function this function mainly using for total sum of number column 

So I am using this function financial reports table sales column sum

()

Parenthesis () surround an expression containing one or more arguments. All functions require at least one argument. An argument passes a value to a function

 Dax functions reference

Topics in this section provide in depth technical reference information for each of the over 200 different dax functions.

Functions are divided into categories such as statistical, filter, date and time, etc…..

1)      Date & time functions

Some dax functions all default all the date & time function return type is datetime

Default time in :12:00:00

Date : 1899:12:00:00  31st 1899--à ja1 st 1900

1)      Today ()

This function returns to the current in system format

Syntax

Today ()

1)      Now () Dax function

This function using for now system time and date format showing

Syntax

Now ()

1)      Year ()

Returns the year of a date as a four digit integer in the range 2017-2018

 Syntax

Year (<date>)

Date : a date datetime or text format, containing the year want to find

Result


1)      Month function (DAX)

Returns the months as a number from 1 (January) to 12 (December).

Syntax

Monthe (<date>)

Date : a date in datetime or text format

1)      Day function

Returns the day of the month, a number from 1 to 31

Syntax

DAY (<date>)

1)      Date

Returns the specified date in datetime format

Syntax :

Date (<year>,<month>,<day>).


1)      Hour function

Returns the hour as a number from 0(12:00 A.M.) to 23 (11:00P.M.).

Syntax

Hour (<datetime>)

Now I am using now dax function now its automatically shows current time and date in a column


1)      minute

returns the minute as a number from 0 to 59, given a date and time value.

Syntax

Minute (<datetime>)

1)      Second function (dax)

Returns the seconds of a time value, as a number from 0 to 59.

Syntax:

Second (<time>)

1)       Time function (dax)

Converts hours, minutes, and seconds given as numbers to a time in datetime format.

syntax

time(hour,minute,second).

1)      Date value function (dax)

Converts a date in the form of text to a date in datetime format.

Syntax

Datevalue(date_text)

Text format

1)      Time value function (dax)

Converts a time in text format to a time in datetime format.

Syntax

Timevalue(time_text)

Time text format

1)      Datediff  function (dax)

Returns the count of interval boundaries crossed between two dates.

Syntax

Datediff(<start_date>,<end_date>,<interval>)


Edate function (dax)

Returns the date that is the indicated number of months before or after the start date. Use edate to calculate maturity dates or dues dates that fall on the same day of the month as the date of issue.

syntax

edate(<start_date>,<months>)

Eo month function (dax)

Returns the date in datetime format of the last day of the month, before of after a specified number of months. Use emonth to calculate maturity dates or due that fall on the last day of the month.

Syntax

Emonth (<start_date>,<months>)

Weekday function (dax)

Returns a number from 1 to 7 identifying the day of the week of a date. By default the day ranges from 1 (Sunday) to 7 (Saturday).

Syntax

Weekday (<date>,<return_type>)

Weeknum function (dax)

Returns the week number for the given and year according to the return_type value. The week number indicates where the week falls numerically within a year.


Calendar function (dax)

Returns a table with a single column named “date” that contains a contiguous set of dates. The range of dates is from the specified start date to the specified end date, inclusive of those two dates.

Caledarauto function (dax)

Returns a table with a single column name “date” that contains a contiguous set of dates. The range of dates is calculated automatically based on data in the model.







 



 























No comments:

Post a Comment