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
SravaniG
Helper I
Helper I

Issue with Include Function in Tableau to Power BI

Hi,

 

I have calculation in tableau like below, I need to replicate this calculation in Power Bi.

 

sum({
INCLUDE DATEPART("month",[Date]) :
COUNTD(
IF [Date] >= [start Date] and [Date] <= [End date]
THEN [ID]
END
)
})

 

my calculation:

CALCULATE(
SUMX(ALLSELECTED([Date]), DISTINCTCOUNT('Table'[ID])),
FILTER(VALUES('Table'[Date]), 'Table'[Date]>=[Start DATE] &&  'Table'[Date]<=[End Date]
)

I have tried in multiple ways. With existance of month in table i am getting correct result, but if i remove month the result coming wrong like summing into number of months.Could anyone help me.

3 REPLIES 3
MFelix
Super User
Super User

Hi @SravaniG ,

 


Try the following code:

ttt =
SUMX (
    FILTER (
        ALLSELECTED('Table'[Date]),
        'Table'[Date] >= [Start DATE]
            && 'Table'[Date] <= [End Date]
    ),
    DISTINCTCOUNT ( 'Table'[ID] )
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I need to show product type and this metric in table. it is showing like kind of grand total, Same value for all product types.

Hi @SravaniG ,

 

It is very difficult to analyze without looking at the data and just by imagining.

Could you share the sample pbix via cloud service like onedrive for business or paste the sample data?

Please remove any sensitive data before uploading.

 

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

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.