Converting hexadecimal to decimal numbers in Power Query

On more than one occasion I saw people writing complex functions in M to convert hexadecimal numbers to decimal ones (Greg Deckler and Soheil Bakhshi, to name a few). In this blog post, I’d like to share probably the quickest way of doing it. Continue reading “Converting hexadecimal to decimal numbers in Power Query”

Understanding model recalculation in Power BI

Have you ever wondered why in Power BI calculated columns and calculated tables are called calculated and measures are not? That’s because in a certain sense, measures aren’t calculated, and calling them “calculated measures” is wrong. In this blog post, I’m discussing the implications of it–what recalculation in Power BI is, and how you can perform it. Continue reading “Understanding model recalculation in Power BI”

Safely transforming column types in Power Query

The Table.TransformColumnTypes function in M throws an error when you try to transform the data type of a column that does not exist. As of March 2020, there is no missingField parameter that can address this issue, in contrast to some other Table functions, like Table.RemoveColumns, which I blogged about before. This blog post shows how to imitate the behavior of the MissingField.Ignore argument in Table.TransformColumnTypes.
Continue reading “Safely transforming column types in Power Query”

Using text measures in multi-row cards in Power BI

A not-so-well-known feature of the multi-row card visual in Power BI is that it can have its own title, called Card Title, in addition to the title any visual can have. In the image above, the Card Title is blue, and it is formatted separately from the visual title. It only works if you use one measure that returns text, and all other visuals are not text. In this blog post, I’m sharing a technique to display text as values in a multi-row card and still have the special Card Title. Continue reading “Using text measures in multi-row cards in Power BI”



There are multiple ways of averaging values in DAX. Some of the most popular ways are mean (AVERAGE), median (MEDIAN) and mode (no built-in function; see DAX Patterns for an example). Yet another is TRIMMEAN, which exists in Excel. There is no corresponding function in DAX, and this blog post shows how you can replicate the function in DAX. Continue reading “TRIMMEAN in DAX”



August 2019 saw the introduction of two new DAX functions: CONVERT and REMOVEFILTERS. They are so new that at the time of writing this blog post (23 August 2019), they are only available in Azure Analysis Services and Power BI service, and even DAX Guide does not list them. In this blog post I’m showing what they are doing. Continue reading “New DAX functions: CONVERT and REMOVEFILTERS”

Safely removing columns in Power Query

Error when removing columns in Power Query

In Power Query, if you remove a column that does not exist, you’ll get an error. While you probably aren’t going to remove a non-existent column on purpose, this may happen when the column in question is removed from your data source.

A popular way to prevent this error from happening is to use the Table.SelectColumns function instead of Table.RemoveColumns. This may potentially bloat your query code if you have many columns to select. You may also use try and otherwise, which again makes your code unnecessarily long. In this blog post, I’m showing an alternative solution. Continue reading “Safely removing columns in Power Query”