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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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