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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pk1593
Helper I
Helper I

Tableau to DAX code

Can anyone help in converting this code to DAX?


S =
ABS([x]-LOOKUP([x],-1))/
(
SQRT
(
ABS(((([y] + LOOKUP([y],-1))/(SUM([z])+LOOKUP(SUM([z]), - 1)])))
*
(1-(([y] + LOOKUP([y],-1))/(SUM([z])+ LOOKUP(SUM([z]),-1)))))/ (1-((1/(SUM([z])+LOOKUP(SUM([z]),-1))))))
*
(1/SUM([z]) + 1/LOOKUP(SUM[z]),-1))
)
)

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @pk1593 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

67E87286-D806-4B96-AA5A-D509D46A171D.jpeg

 Here S (col. highlighted in yellow) is the desired result which ia the significance t-testing forumula.
The table has 3 data points from 2019 to 2021. 
x is in percentage, whereas y and z are weigted and unweighted counts of respective years. 

@v-zhangti - Just wanted to check if you were able to convert the Tableau code to DAX ?

ValtteriN
Super User
Super User

Hi, 

For converting Tableau to DAX try utilizing ChatGPT. It works fast and provides answers like this:

S = ABS([x] - LOOKUPVALUE([x], -1)) / (SQRT(ABS( (([y] + LOOKUPVALUE([y], -1)) / (SUM([z]) + LOOKUPVALUE(SUM([z]), -1))) * (1 - (([y] + LOOKUPVALUE([y], -1)) / (SUM([z]) + LOOKUPVALUE(SUM([z]), -1)))) ) / (1 - ((1 / (SUM([z]) + LOOKUPVALUE(SUM([z]), -1)))))) * (1 / SUM([z]) + 1 / LOOKUPVALUE(SUM([z]), -1)))

You can also replace / with DIVIDE to avoid issues with 0. For the [x], [y] and [z] use the corresponding column refrerences.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




No this is incorrect. 
I tried chatGPT but lookupvalue syntax is wrong and not a substitute for Lookup in Tableau. 

I see, sorry about that. I just read the LOOKUP documentation in Tableau. The dax equivalent for LOOKUP would be OFFSET





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

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.