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 - summarize by averaged column

I'm new to DAX, and struggling how to summarize by calculated column using DAX. In my dataset below, how can I calculate the average sales by price point using DAX? Limitations is that I cannot add price column (value / unit) on my DB. Thus, I need…
Daisuke SHIBATO
  • 983
  • 2
  • 11
  • 23
1
vote
1 answer

Does table expansion happen only on using table name? Or also on using column name?

SUMX(TBLNAME, 1) SUMX(ALL(TBLNAME), 1) SUMX(ALL(TBLNAME[COLNAME]), 1) Does table expansion happen only in 1st and 2nd example? What about the 3rd example. Is there any general list of situations when table expansion occurs?
variable
  • 8,262
  • 9
  • 95
  • 215
1
vote
1 answer

Create three tables from a single excel sheet

I have a summary report that has data from three from different years, lets say 2018, 2019 and 2020- Below is a shared link to sample data from excel The below three tables are in the same sheet of excel. Also, note that these column names are…
1
vote
1 answer

Convert decimal aggregation into days and hours in Power BI

I have a numerical column in Power BI and I display the average of it in a KPI card. It updates every day with data refresh. Is there any way to display the aggregated decimal number in days and hours like 3.5 should be 3 days and 12 hrs. I also…
Shivam Sarin
  • 551
  • 1
  • 7
  • 20
1
vote
1 answer

Does FILTER in CALCULATE add or modify the filter context?

In CALCULATE we can use FILTER(tblname,..) Or FILTER(ALL(tblname),..) I want to ask whether FILTER in CALCULATE adds or modifies (clears and adds new) the existing filter context?
variable
  • 8,262
  • 9
  • 95
  • 215
1
vote
1 answer

Using CALCULATE to inject filter context to a calculated column - does it consist related table columns?

Calculated column does not have any filter context. To inject a filter context we can use the CALCULATE function. Assume I have a sales, location and date table. Sales is fact. The location and date are dimensions connected to the fact…
variable
  • 8,262
  • 9
  • 95
  • 215
1
vote
3 answers

Distinct Count without using CALCULATE

I've come across this DAX measure: # CustMultProds = COUNTROWS( FILTER( Customer, CALCULATE( DISTINCTCOUNT( Sales[ProductKey] ) ) >= 2 ) ) I pretty much understand how it works - it iterates over Customer inside the…
whytheq
  • 34,466
  • 65
  • 172
  • 267
1
vote
1 answer

Calculating Monthly Average over time with only Start and End Dates in Power BI

In order to track our average headcounts and turnover trends, I had created a report in Power BI that essentially expanded a table with employee start/end information to give a record for each associate every day they were employed at the…
kanderson
  • 178
  • 2
  • 13
1
vote
1 answer

Row base calculation wrt the radio buttons in PowerBI

I was a Tableau user and I started to use PowerBI recently. However, I have some troubles about the way to make some inner calculations. Say I have got a toy data with 5 columns as…
maydin
  • 3,715
  • 3
  • 10
  • 27
1
vote
0 answers

How to pass table name dynamically in DAX formula

I would like to call the table name dynamically from a different table. But the DAX formula I used below is not really catering to my needs. Anyone can help me with this, please? m-AvgVolume % = VAR tableName = …
1
vote
2 answers

Power Bi - Total for Period Year Prior Based On SelectedValue Period

Problem: Calculate the total for period of prior year of the period(s) selected in slicer. Table has amount, period, and a date, ie 11/1/2020 for period 11/2020, based on the period. Attempted: Slicer periods selected are 10/2020 and 11/2020. Table…
Neo Owens
  • 51
  • 2
  • 11
1
vote
2 answers

Subtotal <> sum of the rows

I'm a relative neophyte with DAX so bear with me. In the simplest terms, I want to double the measure amount for all regions that are not Europe, then sum the result. Here is some example DAX: DEFINE measure Fact[test] = CALCULATE…
justinm1
  • 71
  • 3
  • 8
1
vote
1 answer

Is there a way to show the sum of a value within a certain time range (ex: 2 days)?

I am measuring the duration in minutes of various tools. The tool can run multiple times in the same day. I would like to flag a tool as "High Use" if the tool runs for more than 20 minutes in a 2 day period. This will be shown in matrix format. For…
1
vote
1 answer

SSAS Tabular - the more measure i created, the more time it need to Visual Studio to created a new measure

Actually my issue is : the more measure i created, the more time it need to Visual Studio to created a new measure. (Visual Studio stay in not reponding) The measures are not really complexe but actually it take thirty seconds~one minute to create a…
MoonLightFlower
  • 173
  • 1
  • 14
1
vote
1 answer

What is the difference between using or avoid using CALCULATE to re-instate a filter?

I am having 2 codes as shown below. The goal is to remove the filter from the filter context. VALUES is used to re-instate the filter. Approach 1: AVERAGEX( VALUES('Sales Order'[Sales Order]), [Revenue] ) Approach 2: CALCULATE( AVERAGEX( 'Sales…
variable
  • 8,262
  • 9
  • 95
  • 215