Forum Discussion
How to use return for multiple values
How can I do it?
I used RETURN but it only lets me show a single variable:
for example what I want to do:
VAR number1 = .....
VAR number2 = .....
RETURN number1, number2
7 Replies
- FowmySuper User
Anonymous
You have it like:
MeassureName =
VAR number1 = x
VAR number2 = y
RETURN
number1 & unichar(10) & number2________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
- PhilipTreacySuper User
Hi Anonymous
Some previous solutions
https://community.powerbi.com/t5/Desktop/return-multiple-Vars-in-Dax/td-p/411089
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up. - AnonymousNot applicable
Hi Anonymous
One calculated column can only show a single variable.
So if you want to show Number1 and Number2 in two columns, you can build two calculated columns or you can build a new table by addcolumns function.
New Table:
ADDCOLUMNS([Table],"Number1",...,"Number2",...)If you use Number1 &“ ”& Number2 like Fowmy's reply, your new value will return as value1 value2 (Separated by spaces) in one column.
And the type of your new column will return to text.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
- AnonymousNot applicable
Good morning, it hasn't worked for me yet.
I will explain a little better. What happens is that I have a measure, which results in some names that can vary. The problem is that I need those names to be able to filter another table where I have those names that help me draw a map. In the map table I have latitude, longitude and names. But I have not been able to do it, I have not been able to relate the result of the names of the measures with the names of the map table.
- AnonymousNot applicable
Hi Anonymous
Did your name measure based on another table or this map table?
You can try to filter the name of the map table by a slicer. However, we can't build a slicer by a measure, you may need to build a name table by dax and relate this table with map table by name.
Ex:
My sample measure may be like:
Measure.Name = CALCULATE(MAX('Table'[Name]),FILTER('Table','Table'[Name]<>"Hawaii"))Build a calculated table :
Name = CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table','Table'[Name]<>"Hawaii"))And filter the name of the map table by this slicer.
If this reply still couldn't help you solve your problem, please show me sample tables like yours, and the result you want.
Or you can provide me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou