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
Niels_T
Post Patron
Post Patron

Can't Select Columns from other tables in DAX

I have the following DAX-formula.

The problem is I can't select any of the columns of the tables where I want to get my data from.
 
Niels_T_0-1645023585711.png
 
Total Direct Cost (Excl. VAT) =
IF('Vendor List'[EU / Non-EU] = "non-EU (EUR)",
'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)]*1,06,

IF('Vendor List'[EU / Non-EU] = "non-EU (USD)", 'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)]*1,35/CALCULATE('Currency Rate'[EUR per unit],'Currency Rate'[Currency] = "USD"),

IF('Vendor List'[EU / Non-EU] = "non-EU (USD)", 'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)]*1,03
)))
1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Niels_T ,

 

It seems that there is a problem with the expression relationship between the if statements (","), which works fine with the following formula:

Total Direct Cost (Excl. VAT) =
IF (
    'Vendor List'[EU / Non-EU] = "non-EU (EUR)",
    'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)] * 1,
    06
)
    && IF (
        'Vendor List'[EU / Non-EU] = "non-EU (USD)",
        'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)] * 1,
        35
            / CALCULATE ( 'Currency Rate'[EUR per unit], 'Currency Rate'[Currency] = "USD" )
            && IF (
                'Vendor List'[EU / Non-EU] = "non-EU (USD)",
                'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)] * 1,
                03
            )
    )

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

 

View solution in original post

6 REPLIES 6
v-henryk-mstf
Community Support
Community Support

Hi @Niels_T ,

 

It seems that there is a problem with the expression relationship between the if statements (","), which works fine with the following formula:

Total Direct Cost (Excl. VAT) =
IF (
    'Vendor List'[EU / Non-EU] = "non-EU (EUR)",
    'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)] * 1,
    06
)
    && IF (
        'Vendor List'[EU / Non-EU] = "non-EU (USD)",
        'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)] * 1,
        35
            / CALCULATE ( 'Currency Rate'[EUR per unit], 'Currency Rate'[Currency] = "USD" )
            && IF (
                'Vendor List'[EU / Non-EU] = "non-EU (USD)",
                'Stock Forecast'[Total Direct Cost (Excl. Last Unit Cost) (Excl. VAT)] * 1,
                03
            )
    )

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

 

Pragati11
Super User
Super User

Hi @Niels_T ,

 

If the tables that you are using in the DAX expression have a relationship in Power BI, then use RELATED function on one of the tables in the DAX expression.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Instead of making a measure, I tried making a column. This almost fixes my problem.

 

I then tried to use related on Vendor List but that didn't work for me.

 

There is a relationship between the two tables.

Hi @Niels_T ,

 

I honestly thought it was a column as I don't see any summarisation on the table columns.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

I changed it now to column. 

 

As you can see some of the columns are still greyed out (see screenshot). Is there a special operator that I need to use to select these?

 

Niels_T_0-1645025537009.png

 

Hi @Niels_T ,

 

Just looking at your DAX, I see folowing issues::

  • On Line 4 you are missing a closing bracket for DIVIDE function
  • You are missing an ELSE condition for your last IF statement

Also try to check your DAX formula on DAX formatter as it gives a good indight on brackets missing, etc. https://www.daxformatter.com/

 

Also why ou are not using RELATED dax function for vendor table?

Also try to copy and paste your DAX here rather than sharing a screenshot.

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.