top of page
Power BI | Excel | Python | SQL
Antriksh Sharma
Writer
Analyst
More actions
Profile
Join date: Apr 7, 2021
Overview
First Name
Antriksh Sharma
Posts (85)
Jan 16, 2026 ∙ 3 min
User Defined FUNCTION in a DAX Query
In this blog let's take a look at how to use DAX's UDF in a DAX Query that mixes TABLE, COLUMN, MEASURE, and FUNCTION keywords. We start with a UDF that returns Dates[Year] by the position that we pass, the focus is primarily on First and Last values when there are Years in Dates table that do not have a row in Sales table. Following UDF code returns First and Last Years: DEFINE FUNCTION FxGetValueByPosition = ( N: INT64 VAL, OrderByCol: ANYREF EXPR, SortOrder: ANYREF EXPR ) => INDEX ( N,...
12
0
Jan 13, 2026 ∙ 1 min
Generate Ranked Pairs in DAX
Let's say you want Top 2 Colors of each Brand, how would you do that? Here are different ways of computing that. Using INDEX & UNION DEFINE VAR Temp = ADDCOLUMNS ( ALL ( Products[Brand], Products[Color] ), "@Sales", [Sales Amount] ) VAR Uno = INDEX ( 1, Temp, ORDERBY ( [@Sales], DESC ), PARTITIONBY ( Products[Brand] ) ) VAR Dos = INDEX ( 2, Temp, ORDERBY ( [@Sales], DESC ), PARTITIONBY ( Products[Brand] ) ) EVALUATE UNION ( Uno, Dos ) ORDER BY...
127
0
Jan 9, 2026 ∙ 2 min
Generate Large Sales Dataset with Python
Today I’m going to show you an application I built with the help of ChatGPT that generates large volumes of Sales data based on the Microsoft's ContosoRetailDW model.
17
0
bottom of page