cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
lbnguyn Frequent Visitor
Frequent Visitor

Dax If statement. I am trying to convert a formular from Tableau to Power BI.

 

Tableau formular:

IF [Unit Nbr] = [Cost Ctr Nbr] then 'DRIVE Unit' else 'Non DRIVE' END

 

Power Bi Dax formular: 

 

Drive Unit = If('AP Paid unit detail'[UNIT_NBR]='Drive_In_Scope_Unit_List'[Cost Ctr Nbr], "Drive Unit", "Non Drive Unit")

 

The problem is " A single value for column 'Cost Ctr Nbr' in table 'Drive_In_Scope_Unit_List' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count....."

 

How can i fix this? 

 

Thank you so much 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Dax If statement. I am trying to convert a formular from Tableau to Power BI.

Hi @lbnguyn 

Assume you have tables

Capture8.JPG

You could create a column/ measure in "AP Paid unit detail" table

Column =
VAR lookvalue =
    LOOKUPVALUE (
        Drive_In_Scope_Unit_List[Cost Ctr Nbr],
        Drive_In_Scope_Unit_List[Cost Ctr Nbr], 'AP Paid unit detail'[UNIT_NBR]
    )
RETURN
    IF ( lookvalue = BLANK (), "Non DRIVE", "DRIVE Unit" )

Measure =
VAR lookvalue =
    LOOKUPVALUE (
        Drive_In_Scope_Unit_List[Cost Ctr Nbr],
        Drive_In_Scope_Unit_List[Cost Ctr Nbr], MAX ( 'AP Paid unit detail'[UNIT_NBR] )
    )
RETURN
    IF ( lookvalue = BLANK (), "Non DRIVE", "DRIVE Unit" )

Capture9.JPGCapture10.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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

4 REPLIES 4
az38 Super Contributor
Super Contributor

Re: Dax If statement. I am trying to convert a formular from Tableau to Power BI.

Hi @lbnguyn 

it looks like are trying to create measure, but you need a calculated column

do not hesitate to give a kudo to useful posts and mark solutions as solution

lbnguyn Frequent Visitor
Frequent Visitor

Re: Dax If statement. I am trying to convert a formular from Tableau to Power BI.

So how can i do that?

Tahreem24 New Contributor
New Contributor

Re: Dax If statement. I am trying to convert a formular from Tableau to Power BI.

Try to use below measure:
Drive Unit = If(Sum('AP Paid unit detail'[UNIT_NBR]) =Sum('Drive_In_Scope_Unit_List'[Cost Ctr Nbr]) , "Drive Unit", "Non Drive Unit")

Please hit Thumbs up and mark it as a solution if it helps you.
Community Support Team
Community Support Team

Re: Dax If statement. I am trying to convert a formular from Tableau to Power BI.

Hi @lbnguyn 

Assume you have tables

Capture8.JPG

You could create a column/ measure in "AP Paid unit detail" table

Column =
VAR lookvalue =
    LOOKUPVALUE (
        Drive_In_Scope_Unit_List[Cost Ctr Nbr],
        Drive_In_Scope_Unit_List[Cost Ctr Nbr], 'AP Paid unit detail'[UNIT_NBR]
    )
RETURN
    IF ( lookvalue = BLANK (), "Non DRIVE", "DRIVE Unit" )

Measure =
VAR lookvalue =
    LOOKUPVALUE (
        Drive_In_Scope_Unit_List[Cost Ctr Nbr],
        Drive_In_Scope_Unit_List[Cost Ctr Nbr], MAX ( 'AP Paid unit detail'[UNIT_NBR] )
    )
RETURN
    IF ( lookvalue = BLANK (), "Non DRIVE", "DRIVE Unit" )

Capture9.JPGCapture10.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)