Click here to Skip to main content
15,353,719 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I'm new user of DAX language and I'm looking for replacing 'WITH' SQL command in DAX. Does someone has an idea if in DAX there is a function that corresponds to 'WITH" SQL command?
I was looking at the internet and didn't found information about this replacement.
Thank you for the hints!

What I have tried:

I was looking at Internet, YT, ebooks
CHill60 21-May-22 5:37am
That depends very much on what you are trying to do!
I use CTEs in Power Query/Power BI all the time.
So the short answer is "no" but that doesn't mean there isn't a solution to your problem... if only we knew what that was
Member 15627495 29-May-22 13:55pm
Hello ,

as WITH is preparing result like 'sub request/embeded requests' in SQL.

DAX need agregration of functions in the main function for your results.

look at dax power bi query in the "microsoft" online.
It looks like excel function writing.

in dax :
my query = function_main(function_on[columns-field] , another_function[another_column-field])

you can chain 64 functions calls in one query.

for a WITH equal :
var_one = dax_query_one(function[column-field])
var_two = dax_query_two(function2[column2-field2])

main_goal_dax_query = function(function[var_one] , function[var_two ] )

so It's a WITH done.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900