The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Solved! Go to Solution.
The 2nd parameter of Table.FirstN() needs to be an expression that evaluates to a whole number.
BUT, you can do something like this.
PreviousStep = //some M code here, Table_with_FirstN = Table.FirstN(PreviousStep, 20), Conditional = //some M code here that says whether or not to apply the FirstN transformation. FinalTable = if Conditional = true then Table_with_FirstN else PreviousStep in FinalTable
Thank you for the answer Chris!
What I liked in your anwer is the simplicity and brevity in the M code.
In following the brevity approach to the problem I've found that the 2nd parameter of Table.FirstN() can be any condition which evaluates to True/False. So, by trying to catch the error condition, I've came to the following solution:
//Using the "try ... otherwise" clause in M //A cell is equal to itself unless it contains an Error SingleStep = Table.FirstN(Table, each try [Column1] = [Column1] otherwise null <> null)
// ( try..otherwise error test )
Greetings,
André
The 2nd parameter of Table.FirstN() needs to be an expression that evaluates to a whole number.
BUT, you can do something like this.
PreviousStep = //some M code here, Table_with_FirstN = Table.FirstN(PreviousStep, 20), Conditional = //some M code here that says whether or not to apply the FirstN transformation. FinalTable = if Conditional = true then Table_with_FirstN else PreviousStep in FinalTable
Thank you for the answer Chris!
What I liked in your anwer is the simplicity and brevity in the M code.
In following the brevity approach to the problem I've found that the 2nd parameter of Table.FirstN() can be any condition which evaluates to True/False. So, by trying to catch the error condition, I've came to the following solution:
//Using the "try ... otherwise" clause in M //A cell is equal to itself unless it contains an Error SingleStep = Table.FirstN(Table, each try [Column1] = [Column1] otherwise null <> null)
// ( try..otherwise error test )
Greetings,
André
User | Count |
---|---|
60 | |
55 | |
53 | |
49 | |
30 |
User | Count |
---|---|
179 | |
87 | |
71 | |
48 | |
46 |