Forum Discussion

swatisharma_1's avatar
swatisharma_1
Regular Visitor
3 years ago

How to change Tableau LOD Include function to DAX

Hello, I am new to Power BI and stuck with the PBI report developement where Include LOD function shoul dbe incorporated. Below is the existing calculation being created and Tbaleau and need to know how to acheive the same in DAX.

"FLOAT(If [Project] = 'Filled' then {INCLUDE [Project ID],[Work ID]:SUM([Resource Count])} END)"

 

2 Replies

  • Hi swatisharma_1 ,

     

     You can use the following DAX expression for a calculated column:

    NewColumn =
    
    IF (
    
        'YourTableName'[Project] = "Filled",
    
        CALCULATE (
    
            SUM ( 'YourTableName'[Resource Count] ),
    
            ALLEXCEPT ( 'YourTableName', 'YourTableName'[Project ID], 'YourTableName'[Work ID] )
    
        ),
    
        BLANK ()
    
    )

    Replace 'YourTableName' with the actual name of your table in Power BI. This DAX expression checks if the Project column has the value "Filled" and then calculates the sum of the Resource Count column for each unique combination of Project ID and Work ID. If the Project column doesn't have the value "Filled", it returns a blank value.

     

    Best Regards,

    Jianbo Li

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

    • swatisharma_1's avatar
      swatisharma_1
      Regular Visitor

      Hello, Thank you for your response.

      Getting an error after applying the given condition by you 

      "A single value for column "'YourTableName'[Project] = "Filled" in table cannot be determined.

      DAX which i have used for Project and Assignment Columns

      Project = IF(AND(YourTableName[Status]="APR Lifecycle Ended", YourTableName[Sub Status]="Cancelled"),"Cancelled",YourTableName[Assignment])
      Assignment= Its a Group i have created by right-click on one of the elements, scroll to Group, and choosen Group from the context menu.
       
      Please suggest.