Questions tagged [dax]

Expression language used in Microsoft Power Pivot, Analysis Services, and Power BI for performing analytical calculations.

DAX stands for Data Analysis eXpressions, an expression language created by Microsoft for performing custom analytical calculations within the Power Pivot add-in for Excel, Analysis Services, and Power BI.

DAX functions work on a column or table level to make use of the underlying compression technology used in PowerPivot.

Expressions created in DAX can be used in several ways:

  1. In calculated columns, evaluating the function on a row-by-row basis over an entire table.
  2. In measures, which may be manipulated and aggregated differently, depending on context.
  3. To return a tabular resultset when a table expression is evaluated (fills role of a general purpose query language)
  4. To create a calculated table in a Power BI model as part of the modelling process

Useful Links

8483 questions
1
vote
1 answer

DAX PowerBi - Multiplication in a measure gives a wrong sum in the total-row of a table-visualization

I have two tables, "stock" and "prices". In table "stock" I made a calculated column in the DAX-editor (called "Voorraad"). Voorraad = CALCULATE (COUNT(stock[EAN]), stock[Locatie] IN {"magazijn", "ontvangst"}) The two tables are related on "EAN", a…
Ekfa
  • 93
  • 3
  • 15
1
vote
1 answer

MTD Budget with Fiscal Calenar

I have a simple budget table, that shows me the weekly budget: Week - Budget - Article Now I would like to get a running total for the MTD comparision. For this purpose I divide the weekly budget by the number of working days: Budget per Day =…
Aaron
  • 329
  • 3
  • 15
1
vote
0 answers

Dax gives me 2 drastically different answers when I use Date Add

When I use PY Apps = CALCULATE([CY Apps],DATEADD('Transaction Date'[Date],-365,DAY)) I get the Total $4,704 (which is what I was expecting) When I use PY Apps = CALCULATE([CY Apps],DATEADD('Transaction Date'[Date],-1,YEAR)) I get $13,926 why such…
1
vote
1 answer

Measure Total in DAX

I have a simple data model with two dimensions and a fact table. The dimensions are called BondDim and AccountDim. They slice the fact table. The BondDim and AccountDim join to the fact table in a one-to-many relationship. I would like to create the…
Wadstk
  • 175
  • 3
  • 12
1
vote
1 answer

How to Calculate Std. Dev. of Measure after Aggregating Rows with DAX/PowerBI

I have a table like this with a calculated step rate column. I would like to get a summarized step rate for certain hours going back 5 weeks. Here's the summarized step rates. Then I would like to get the std. dev. of those summarized step…
1
vote
1 answer

Dfference Between Two running total query

I have written two types of Running total with dates as below:- 30 days running Total Sales = CALCULATE ( [Total Sales], FILTER ( ALL ( Dates ), Dates[Date] > MAX ( Dates[Date] ) - 30 && Dates[Date] <= MAX (…
dan_karan
  • 27
  • 3
1
vote
0 answers

Problem Stock Profit calculation with FIFO method in Power BI DAX query

Problem: I am trying to calculate share profit based FIFO method for Buy and Sell transactions. Here is the actual result (calculated manually in Excel) Please note this is just for only a stock, I have many other stocks in my data. Here is the…
Bhushan Z
  • 11
  • 2
1
vote
0 answers

Eliminating repetitive Storage Engine queries in Power BI

Please see the Power BI model file attached here. I have an Activity table and I'd like to plot on a Line chart, the number of users that were active in the last 365 days as on the date of X Axis. Hence, I created a date table, but it is not related…
Shahid Thaika
  • 2,133
  • 5
  • 23
  • 59
1
vote
1 answer

Pivot or Power Pivot: how to calculate the other as a remainder between subtotal and top N items

I am trying to create a calculated item in Excel pivot that would calculate the "other" as the difference between subtotal of the group and top N selected items. Here is the example of original data table and the current pivot table. The Product…
Yury G
  • 36
  • 3
1
vote
1 answer

DAX: count rows in table1 where data from 1 column is equal to data from table2, returning the sum to table2

I have one table: STOCK. It has (among other things) a column: EAN and LOCATION. I'd like to know my total of stock of a certain EAN in LOCATION 'stockroom' or 'return'. ID - EAN - LOCATION 01 - 3344556677 - stockroom 02 - 3344556677 - stockroom 03…
Ekfa
  • 93
  • 3
  • 15
1
vote
1 answer

How to get distinct count of rows in powerbi, while filtering based on two columns

I have a table with multiple date columns. As we cannot use two separate x axis is same chart, I am creating a separate table with required data. My old table has a categorical column "label" and a date column "date". My new table has a "date"…
Kreeeeee
  • 35
  • 5
1
vote
1 answer

How to create a complex filter from a single value passed in from USERNAME() function

I am generating Power BI embedded tokens for Row Level Security. The token contains a value of a role for the USERNAME() function to receive, which is then used in the Table filter DAX expression, e.g.: [Region] = USERNAME(). This works when a value…
cjjw
  • 13
  • 3
1
vote
1 answer

PowerBI DAX for Finding Last Record

Question What is an efficient way to create a calculated column finding the last value of my DATE column, using the ModifiedOn column, per ID? I don't want the MAX date, just the last record (even if the last record is the minimum). Also, my table…
Naomi
  • 23
  • 1
  • 5
1
vote
1 answer

Power BI - rankx with filter

I've been struggling with this and hope someone is able to help... I have a table with sales for products over multiple years. There is a measure that gives me the total revenue for each year by customer, ignoring product sold: totalRevenueMeasure…
U01SFA3
  • 15
  • 4
1
vote
1 answer

Trying to create a calculated table based on Max() values of a drill through of an unrelated table Power BI

In Power BI, I'm trying to use a measure to take the = MAX(CallDetails[Date]) that is left once I drill through on a visual. To create a calculated table. That is a filtered version of an unrelated table AgentActivities by [Max Date]. My goal is to…
dvdccd
  • 13
  • 3
1 2 3
99
100