Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I need to create a column that contains the row number, exactly like the red numbers on the print below:
*It has to be on DAX because It is a calculated table from M code
*It will always have 4 rows
*I do not intend to rank the rows by the name, only by normal order
Could someone help me?
Solved! Go to Solution.
Here is one way to do it with DAX (without RANKX). Just create a DAX table with the expression below.
MonthTable =
VAR fourmonthsago =
EOMONTH( TODAY(), -4 )
VAR monthdates =
ADDCOLUMNS(
GENERATESERIES( 1, 4, 1 ),
"Mes/Ano", FORMAT( EOMONTH( fourmonthsago, [Value] ), "mmm/yy" )
)
RETURN
monthdates
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Here is one way to do it with DAX (without RANKX). Just create a DAX table with the expression below.
MonthTable =
VAR fourmonthsago =
EOMONTH( TODAY(), -4 )
VAR monthdates =
ADDCOLUMNS(
GENERATESERIES( 1, 4, 1 ),
"Mes/Ano", FORMAT( EOMONTH( fourmonthsago, [Value] ), "mmm/yy" )
)
RETURN
monthdates
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
If you just need a 4-row/2-column table, you could just use the DATATABLE function.
Or, if it needs to be dynamic and show the last 4 months, you could calculate a Date column from the month/year and then use RANKX on that to get 1-4.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |