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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Gaurav51478
Frequent Visitor

Tableau for to Dax

Hello Everyone

 

I am doing tableau migration to Power BI, So i am converting one single form from tableau code to dax

 

Tableau Formula:
(COUNTD(IF ([Sales Type]="AS" AND [Type]="Subs") THEN [Ord Nbr] ELSE NULL END))+
SUM(IF ([Sales Type]="PS" AND [Type]="Subs") THEN [Qty] ELSE 0 END)

I have tried this  below dax

DAX
If(Table[Type]="Subs" && WW_Subscription5[SALES_TYPE]="APOS",DISTINCTCOUNT(WW_Subscription5[ORD_NBR]),BLANK())
+
If(WW_Subscription5[Type]="Subs" & WW_Subscription5[SALES_TYPE]="POS",Sum([Qty]),0)
Please help
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Gaurav51478 ,

Please have a try.

Column =
VAR _COUNTD =
    CALCULATE (
        DISTINCTCOUNT ( 'TABLENAME'[ORD_NBR] ),
        FILTER (
            'TABLENAME',
            'TABLENAME'[Type] = "Subs"
                && 'TABLENAME'[SALES_TYPE] = "APOS"
        )
    )
VAR RESULT =
    CALCULATE (
        SUM ( 'TABLENAME'[QTY] ),
        FILTER (
            'TABLENAME',
            'TABLENAME'[Type] = "Subs" & 'TABLENAME'[SALES_TYPE] = "POS"
        )
    )
RETURN
    _COUNT + RESULT

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Gaurav51478 ,

Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

 

Best Regards

Community Support Team _ Polly

 

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

Anonymous
Not applicable

Hi @Gaurav51478 ,

Please have a try.

Column =
VAR _COUNTD =
    CALCULATE (
        DISTINCTCOUNT ( 'TABLENAME'[ORD_NBR] ),
        FILTER (
            'TABLENAME',
            'TABLENAME'[Type] = "Subs"
                && 'TABLENAME'[SALES_TYPE] = "APOS"
        )
    )
VAR RESULT =
    CALCULATE (
        SUM ( 'TABLENAME'[QTY] ),
        FILTER (
            'TABLENAME',
            'TABLENAME'[Type] = "Subs" & 'TABLENAME'[SALES_TYPE] = "POS"
        )
    )
RETURN
    _COUNT + RESULT

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

lbendlin
Super User
Super User

What issue did you encounter when you tried it?

 

Note:  Probably a bad idea to try and add NULL and a number - both in Tableau and Power BI.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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