🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 5 Min Lesezeit
0

Mastering DAX in Power BI: A Beginner’s Guide

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Introduction






1. What is DAX?



DAX (Data Analysis Expressions) is the formula language used in Power BI, Excel Power Pivot, and SQL Server Analysis (SSAS). It is designed to handle data manipulation and computations, allowing for powerful data models and analysis.


Example Scenario: Imagine you have a dataset of retail transactions. You want to calculate total sales, profit margin, or year-over-year growth. DAX enables you to write formulas that generate these values dynamically, adapting to filters and user selections in your reports.


It plays a vital role in enhancing the reporting and analysis capabilities of Power BI, enabling users to dive deeper into their data by creating custom insights.


DAX is the primary used for creating calculated columns, calculated measures and managing relationships between data tables.


This guide introduces essential DAX functions and concepts to get you started with creating powerful calculations in Power BI.





2. Essential DAX Concepts and Functions





Calculated Columns vs. Measures



Understanding the difference between calculated columns and measures is crucial when working with DAX:



Calculated Columns: These are computed row-by-row and added to your data model as new columns. They are useful for creating static calculations.



Example: Calculating a Profit column in the Sales table:




CODE
 Profit = Sales[Revenue] - Sales[Cost]






Measures: Measures are dynamic calculations that aggregate based on the current filter context, which means they change based on the data you view in your reports. Measures are great for calculations like sums, averages, and ratios.



Example: Calculating total sales as a measure:




CODE
 Total Sales = SUM(Sales[Amount])









3. Key DAX Functions Categories with examples






3.1 Aggregate Functions:



SUM: Adds up all the values in a specific column.


Example: This DAX formula calculates the total sales amount from the SalesAmount column of the Sales table.




CODE
 Total Sales = SUM(Sales[SalesAmount])






AVERAGE: Returns the average of all values in a column.


Example:




CODE
 Average Sales = AVERAGE(Sales[SalesAmount])






This computes the average sales amount for all rows in the Sales table.


COUNT: Counts the number of non-blank cells in a column.


Example:




CODE
 Number of products = COUNT(Products[ProductID])






This counts the number of non-empty ProductID entries in the Products table.


SUMX: This performs row-by-row calculations for each record in a table and then returns the total sum of these calculations.


Example:




CODE
 Total Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])






This formula multiplies Quantity by UnitPrice for each row and sums the result across all rows.






3.2 Filter Funtions:



CALCULATE: Modifies the filter context of an expression, allowing you to customize the filters applied to your calculations.


Example:




CODE
 Sales in West = CALCULATE(SUM(Sales[Amount]), Sales[Region] = "West")






This calculates the total sales only for the west region, regardless of any other filters applied.


FILTER: Returns a table containing only rows that satisfy a given condition.


Example:




CODE
 Expensive Products = FILTER(Products, Products[Price] > 100)






This filters out products that cost more than 100, returning only those rows.


ALL: Ignores any filters that might be applied to a column or table.


Example:




CODE
 Total Sales All Regions = CALCULATE(SUM(Sales[SalesAmount]), ALL(Sales[Region]))






This calculates the total sales without considering any filters on the Region column.


RELATED: Retrieves values from a related tables using relationships.


Example:




CODE
 Product Name = RELATED(Products[ProductName])






This pulls the product name from the Products table into the Sales table, assuming a relationship exists between the two tables.






3.3 Time Intelligence Functions:



SAMPLEPERIODLASTYEAR: Compare data from the same period in the previous year.


Example:




CODE
 Sales Last Year = CALCULATE(SUM(Sales[SalesAmount]),SAMPLEPERIODLASTYEAR(Sales[Date]))






This formula calculates the total sales for the same period last year.


TOTALYTD: Calculates the year-to-date total measure.


Example:




CODE
 YTD Sales = TOTALYTD(SUM(Sales[SalesAmount]), Sales[Date])






This gives the total sales from the beginning of the year to the current date.


DATEADD: Shifts dates in a date column by a specified number of days, months, or years.


Example:




CODE
 Sales Previous Month = CALCULATE(SUM(Sales[SalesAmount]),  DATEADD(Sales[Date], -1, MONTH))






This moves the date back by one month and calculates the sales for that period.






3.4 Logical Functions:



IF: Evaluates a condition and returns one values if the condition is TRUE and another if it is FALSE.


Example:




CODE
 SalesCategory = IF(SUM(Sales[SalesAmount] > 1000,"High","Low")






This classifies sales into "High" or "Low" categories based on whether the SalesAmount is greater than 1000


AND: Returns TRUE if all conditions are TRUE


Example:




CODE
 Big Discount = IF(AND(Sales[Quality] > 50, Sales[Discount] > 10), "Yes","No")






This checks if both conditions (quantity greater than 50 and discount greater than 10 are met, then labels them "Yes" or "No".


OR: Returns TRUE if atleast one conditions is TRUE


Example:




CODE
 Special Offer = IF(OR(Sales[Quality] > 100, Sales[Discount] > 20), "Special","Regular")






Thsi checks if either quantity is greater than 200 or the discount is greater than 20.






3.5 Text Functions



CONCATENATE: Joins two or more strings into one.


Example:




CODE
 Full Product Name = CONCATENATE(Products[ProductName],"-", Products[Category])






This joins the product name and category with a hyphen in between.


UPPER: Converts text to uppercase.


Example:




CODE
 Upper Product Name = UPPER(Products[ProductName])






This converts the product name to uppercase.


LEFT/RIGHT: Extracts a specified number of characters from the left or right side of a text string.


Example:




CODE
Left Part of Name = LEFT(Products[ProductName], 5)






This returns the first 5 characters from the left of the product name.






5.6 Mathematical Functions:



DIVIDE: Performs division and handles division by zero.


EXAMPLE:




CODE
 Price Per Unit = DIVIDE(Sales[Amount], Sales[Quantity])






This calculates the price per unit, handling cases where the quantity might be zero.


MOD: Returns the remainder of a division operation.


Example:




CODE
 Remainder = MOD(Products[Quantity],2)






This returns the remainder when dividing the quantity by 2 (Useful for checking odd or even numbers)






Conclusion:



DAX provides a powerful set of functions that allow you to create dynamic, context-aware calculations in Power BI. By using aggregate, filter, time intelligence, and logical functions, you can craft precise and flexible reports and dashboards. It's essential to understand how these functions interact with your data model, especially in terms of context and relationships, to build complex and insightful calculations.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Mastering DAX in Power BI: A Beginner’s Guide

Thematisch verwandte Begriffe: Mastering, Power, Beginners, Guide · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...