Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Use of one VAR in different tables

Hi, I got different tables in my reports but in each of them I use a calculated column where I create the variable: VAR Version = 787_501.

I will need to change this sometimes, and I would like to know if there is a way to declare a variable in only ONE table, and use it in the others, and if no, is there any way to make something like that?

Thank you!

1 ACCEPTED SOLUTION

Is it because, you have quotes in the data itself i.e in version table "787_501" instead of 787_501




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

7 REPLIES 7
PattemManohar
Community Champion
Community Champion

@Anonymous It's possible by having a separate table for version and use the "LOOKUPVALUE" funtion in your calculated column logic. 

 

image.png

 

Use the below as your calculated column logic and the value gets updated if you update the version value in the above table.

 

Version = LOOKUPVALUE(Versioning[Version],Versioning[Sno],1)

Let me know if any issues !





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Thanks for the help!
The formula return the correct value but it seem like it does not work with my filter.. To be more precise, only this part of the formula is working, (so where I do not use the variable).Screen Shot 09-17-19 at 11.49 AM.PNG

 Is there a problem with my way to concatenate ? For example it should write "test 787_501\Development"
When I use: VAR Versions = "787_501" it works , but when I use

VAR Versions = LOOKUPVALUE('Version'[Version];'Version'[Colonne];1) 
which actually returns: "787_501" , I've tested it, it does not works...

Is it because, you have quotes in the data itself i.e in version table "787_501" instead of 787_501




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

I was sure I tried with and without quotes... It look like I was wrong, it works...
Thank you very much to you and @sturlaws !

@Anonymous,

 

have you tried without the quotes around 787_501?

 

-s

sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

If I understand you correctly, [Var Version] is a constant. Then you can either have it in a table designated for this constant, or you can add it to just one of the table, and create calculated columns in the other tables like this:

VAR Version = min('Other table'[VAR Version]

cheers,
S

Anonymous
Not applicable

You understood perfectly, when I first read your comment , I thought : yes that's it.
BUT Smiley Happy it seem like it doesn't works...
I've created a table "Version" with only one cell called " "787_501" ", 
I've tried just to use your formula and return it to see if it works as intended:
Screen Shot 09-17-19 at 11.48 AM.PNG
And it does... But when I use the formula in my other tables like this:
Screen Shot 09-17-19 at 11.49 AM.PNG

It doesn't works, there is no error but I have a different result from before in my column... I don't understand why.

Thank you for your reply

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.