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
Ritika0307
Frequent Visitor

How do i convert the tableau LOD Calculation to Power BI. I am not getting the desired output.

I have a LOD calculation in tableau as below.

 

{FIXED [Casenumber],[Adobe Date],[Account_Name__C],[Contact_Name__C],[Case Created Date],[Fiscal Date],[SEARCH_TERM],[Asset Name]

: COUNTD(IF ([Scenario (trim)] = 'Web activities but No Case Created')

 THEN [Casenumber] END)

}

It returns a distinct count of casenumbers based on the columns mentioned in the fixed syntax.

 

I tried converting the same in Power bi using the below DAX. But i am not getting correct output.

 
Self_service_success = CALCULATE(DISTINCTCOUNT('TB'[CASENUMBER]),'TB'[SCENARIO]="Web activities but No Case Created",ALLEXCEPT('TB','TB'[CASENUMBER],'TB'[V05_DATE],'TB'[ACCOUNT_NAME__C],'TB'[CONTACT_NAME__C],'TB'[CREATEDDATE],'TB'[FISCAL_MONTH],'TB'[V02_SEARCH_TERM],'TB'[V20_ASSET_NAME]))
 
Is there any other way in which i can convert the LOD to power bi DAX measure?
3 REPLIES 3
shreyamukkawar
Resolver II
Resolver II

Hi @Ritika0307 

 

CALCULATE(
DISTINCTCOUNT(
IF(
[Scenario (trim)] = "Web activities but No Case Created",
[Casenumber]
)
),
FILTER(
ALL(
'Table'[Casenumber],
'Table'[Adobe Date],
'Table'[Account_Name__C],
'Table'[Contact_Name__C],
'Table'[Case Created Date],
'Table'[Fiscal Date],
'Table'[SEARCH_TERM],
'Table'[Asset Name]
),
'Table'[Casenumber] = MAX('Table'[Casenumber]) &&
'Table'[Adobe Date] = MAX('Table'[Adobe Date]) &&
'Table'[Account_Name__C] = MAX('Table'[Account_Name__C]) &&
'Table'[Contact_Name__C] = MAX('Table'[Contact_Name__C]) &&
'Table'[Case Created Date] = MAX('Table'[Case Created Date]) &&
'Table'[Fiscal Date] = MAX('Table'[Fiscal Date]) &&
'Table'[SEARCH_TERM] = MAX('Table'[SEARCH_TERM]) &&
'Table'[Asset Name] = MAX('Table'[Asset Name])
))


Best Regards,

Shreya

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

OwenAuger
Super User
Super User

Hi @Ritika0307 

To replicate the behaviour of this FIXED LOD calculation, I would suggest using REMOVEFILTERS/SUMMARIZE rather than ALLEXCEPT.

 

I believe this should work as expected:

Self_service_success =
CALCULATE (
    DISTINCTCOUNT ( 'TB'[CASENUMBER] ),
    'TB'[SCENARIO] = "Web activities but No Case Created",
    -- Remove filters on TB table...
    REMOVEFILTERS ( 'TB' ),
    -- ...but add back a filter corresponding to visible combinations of these columns
    SUMMARIZE (
        'TB',
        'TB'[CASENUMBER],
        'TB'[V05_DATE],
        'TB'[ACCOUNT_NAME__C],
        'TB'[CONTACT_NAME__C],
        'TB'[CREATEDDATE],
        'TB'[FISCAL_MONTH],
        'TB'[V02_SEARCH_TERM],
        'TB'[V20_ASSET_NAME]
    )
)

 

The reason not to use ALLEXCEPT in this case is that it will only retain filters that exist on the specific columns listed, but will not retain values in those columns resulting in crossfiltering from other columns. In Tableau, FIXED does retain filters resulting from crossfiltering on the listed columns.

 

Does the above expression work as expected?

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hello , i tried the above calculation , seems like after summarizing the columns it is only returning the distinct count of the casenumber. I want to see the count of the distinct rows the summarize statement is returning. ( I believe summarize is similar to group by).

 

If possible , i want to get DAX calculation equivalent to this sql statement.


SELECT sum(count(DISTINCT(CASENUMBER))) FROM TB WHERE SCENARIO ='Web activities but No Case Created'  GROUP BY V05_DATE ,ACCOUNT_NAME__C ,CONTACT_NAME__C ,CREATEDDATE ,FISCAL_MONTH ,V02_SEARCH_TERM ,V20_ASSET_NAME ; 

 

Thanks

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.

Top Solution Authors