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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
sreddy47652
Helper III
Helper III

Convert Tableau expression into power bi DAX

Hi Team, Need some help to convert tableau expression to power bi "ATTR([TSR Created Date _ Today N])", i tried with selectedvalue function but it's not working so can anyone help me how to convert from Tableau to Power bi.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@sreddy47652 These usually go better if you provide sample data and expected result but in this case, I believe the equivalent DAX is:

 

Measure = 
  VAR __Table = SUMMARIZE( 'Table', [TSR Created Date _ Today N] )
  VAR __Result = IF( COUNTROWS( __Table ) > 1, "*", MAXX( __Table, [TSR Created Date _ Today N] ) )
RETURN
  __Result

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @sreddy47652 ,

See the below data:

vyilongmsft_0-1724221325433.png

When I use attr:

vyilongmsft_1-1724221216437.png

Final I get:

vyilongmsft_2-1724221216615.png

 

Import data to Power BI:

vyilongmsft_1-1724221885581.png

You can try this DAX code: 

ATTR = 
VAR MAXVALUE =
    CALCULATE (
        MAX ( 'Table'[State] ),
        FILTER ( ALL ( 'Table' ), 'Table'[City] = MAX ( 'Table'[City] ) )
    )
VAR MINVALUE =
    CALCULATE (
        MIN ( 'Table'[State] ),
        FILTER ( ALL ( 'Table' ), 'Table'[City] = MAX ( 'Table'[City] ) )
    )
RETURN
    IF ( MAXVALUE = MINVALUE, MAX ( 'Table'[State] ), "*" )

Finally you will get what you want.

vyilongmsft_2-1724222279081.png

 

 

 

Best Regards

Yilong Zhou

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

Greg_Deckler
Super User
Super User

@sreddy47652 These usually go better if you provide sample data and expected result but in this case, I believe the equivalent DAX is:

 

Measure = 
  VAR __Table = SUMMARIZE( 'Table', [TSR Created Date _ Today N] )
  VAR __Result = IF( COUNTROWS( __Table ) > 1, "*", MAXX( __Table, [TSR Created Date _ Today N] ) )
RETURN
  __Result

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

December 2024

A Year in Review - December 2024

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