The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi, I have not used index in dax pbi, but thouhgt I'd have a look, so created a date table ;
dDate =
ADDCOLUMNS(
CALENDAR( DATE( 2020,1,1), DATE( 2025,12,31) ) ,
"Year", YEAR([Date]),
"Month", FORMAT([Date],"MMM") ,
"ms", MONTH([Date]),
"FiscalQ", CEILING( MONTH( EDATE([Date],-3)),3) /3
)
and then decided to use index to bring back the top row, so in excel Index( Table, 1, 0 ) ,
Table = INDEX(1 , dDate, ORDERBY(dDate[Date]) )
but i get a message saying it may have duplicate rows, well it's a calendar so I don't think so,
Richard.
Solved! Go to Solution.
@Dicken , I created a table with the same code, and it worked
In case of measure use
Maxx( INDEX(1 , dDate, ORDERBY(dDate[Date]) ), [Date])
Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U
@Dicken Try this :
use distinct around the table you are using in window functions
let me know if this works
no,
CALENDAR(DATE(2020,1,1), DATE(2020,12,31) ) ,
Then new table
Table 2 = DISTINCT(WINDOW(1,ABS,1,ABS ,'Table') )
Erorr message
WINDOW's Relation parameter may have duplicate rows. This is not allowed.
But it will acceept
Table = WINDOW(1,ABS,1,ABS,
CALENDAR(DATE(2020,1,1), DATE(2020,12,31) ) )
Richard.
@Dicken , I created a table with the same code, and it worked
In case of measure use
Maxx( INDEX(1 , dDate, ORDERBY(dDate[Date]) ), [Date])
Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U
Sorry, just to add did this in power pivot Dax studo, but this is what I would expect index to return,
a one row ( top ) table;
EVALUATE
FILTER( 'Calendar',
'Calendar'[Date] = DATE( 2020,1,1)
)
Richard.
So does it return a table, as that's what I was using;
New Table,
out of interest I get the same message for window.
so still none the wiser as to how it works,
i thought I'd try a simpler date table ;
dDate = ADDCOLUMNS(
@Dicken Try this :
use distinct around the table you are using in window functions
let me know if this works
Thanks,
RD
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
108 | |
78 | |
77 | |
46 | |
39 |
User | Count |
---|---|
137 | |
108 | |
64 | |
64 | |
53 |