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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power BI IF Statement

=if (SALES_CODE='W',PART_NBR, 'ACCS')

 

How would this QlikView calculation be in Power BI? I have tried but it did not seem right.

 

5 REPLIES 5
v-shex-msft
Community Support
Community Support

HI @Anonymous,

Where did this data field host? In the current table or related tables? Can you please share some dummy data to help us clarify your scenario and test to coding formula?

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
ryan_mayu
Super User
Super User

@Anonymous 

Are you creating a column or a measure? Please provide some sample data.





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

Proud to be a Super User!




edhans
Super User
Super User

Is this a measure or a calcluated column? If the latter (which I recommend against) it is:

 

=if ([SALES_CODE]='W',[PART_NBR], [ACCS])

 

If the former, we will need more context as to what is happening. Some sample data would be good.

If you want a column of this and need to do it in Power Query, which I highly recommend, then:

=if [SALES_CODE]='W' then [PART_NBR] else [ACCS]

In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Thank you for the update.

 

So in QlikView this is a caculated dimension, so I was trrying to replicate this in Power BI. 

 

Thank you, and I will try the latter calculation!

 

Thanks,


Chin_IT

Glad to help @Anonymous 

 

Please mark one of these posts as the solutoin if it worked for you so the thread can be marked solved and others can find it, or post back with further questions if you need more help making it work.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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