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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Syndicate_Admin
Administrator
Administrator

Formula If+Atrr a power bi

Hello, I'm looking for a way to make this formula that I have in tableau a power bi

IF ATTR([Line ID]) = 'ALA' THEN AVG([Freepool])
ELSEIF ATTR([Line ID]) = 'CTS' THEN AVG([Freepool])
ELSE SUM([Freepool])
END

1 ACCEPTED SOLUTION

Hi @Syndicate_Admin ,

 

Oh I see! I thought Attr would be the name of the table and [line ID] a column name in the table. Could SELECTEDVALUE or VALUE be the PBI equivalent to the ATTR function in Tableua? Note, this is a pretty wild guess.

 

Otherwise, you might be able to give a little bit more of a context on what you would like to achieve maybe even with some sample data?

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @Syndicate_Admin 

Thanks for reaching out to us.

I just want to confirm if you resolved this issue? If yes, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.

If you need more help, please let me know.

 

Best Regards,

Community Support Team _Tang

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

Syndicate_Admin
Administrator
Administrator

Hi Tom, thanks but it did not work for me, in power bi it does not have the ATTR as in tableau.

Hi @Syndicate_Admin ,

 

Oh I see! I thought Attr would be the name of the table and [line ID] a column name in the table. Could SELECTEDVALUE or VALUE be the PBI equivalent to the ATTR function in Tableua? Note, this is a pretty wild guess.

 

Otherwise, you might be able to give a little bit more of a context on what you would like to achieve maybe even with some sample data?

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

tackytechtom
Super User
Super User

Hi @Syndicate_Admin 

 

How about this:

IF ( ATTR([Line ID]) = "ALA", AVERAGE ( [Freepool] ), IF ( ATTR([Line ID]) = "CTS" ), AVERAGE ( [Freepool] ), SUM ( [Freepool] ) ) )

 

Let me know if this works 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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