Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Bakhtawar
Post Patron
Post Patron

dax example

i want examples of these points .. 

 

  • Any DAX function always refers to a complete column/field or a table. It will never refer to individual values. If you want to use the functions on separate values within a column, you need to apply filters in a DAX formula.
  • DAX functions provide the flexibility to create a formula that is applied on a row-by-row basis. The calculations or formulas get applied as per the context of the values in each row.

any example please?

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

So, an example of the first one, to get to an individual value of a cell you could do something like this:

 

Measure = MAXX(FILTER('Table',[Column] = "Something"),[Value])

 

This would filter the table "Table" to only the rows where "Column" equals the value "Something" and then return the maximum value in the Value column from that subset. Note, there are literally tens of thousands if not hundreds of thousands of examples that could be provided for this because it is how DAX works. It is a core concept and I include it in my book in the first chapter "Thinking DAX".

 

Correct, this would be a calculated column like:

New Column = [Column1] + [Column2]

 

Each row would take the value in Column1 and Column2 for that row and add them together into the new column, "New Column".

 

Or, in a measure, you can use ADDCOLUMNS and it's the same sort of thing.

 

 

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Hi @Bakhtawar ,

 

Here is the test data.

2-1.PNG

Then I created a measure:

Measure = 
SUM('Table'[Column3])

Now you could do see the different results with column1 and column2.

3-1.PNG

The measure will show different result depends on your context.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

So, an example of the first one, to get to an individual value of a cell you could do something like this:

 

Measure = MAXX(FILTER('Table',[Column] = "Something"),[Value])

 

This would filter the table "Table" to only the rows where "Column" equals the value "Something" and then return the maximum value in the Value column from that subset. Note, there are literally tens of thousands if not hundreds of thousands of examples that could be provided for this because it is how DAX works. It is a core concept and I include it in my book in the first chapter "Thinking DAX".

 

Correct, this would be a calculated column like:

New Column = [Column1] + [Column2]

 

Each row would take the value in Column1 and Column2 for that row and add them together into the new column, "New Column".

 

Or, in a measure, you can use ADDCOLUMNS and it's the same sort of thing.

 

 

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

and second one ?

Hi @Bakhtawar ,

 

Here is the test data.

2-1.PNG

Then I created a measure:

Measure = 
SUM('Table'[Column3])

Now you could do see the different results with column1 and column2.

3-1.PNG

The measure will show different result depends on your context.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.