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

Tableau expresstion to DAX

Hi,

 

So I'm a heavy Tableau user and I wrote this expression 

 

    if(DATEDIFF('year',[Actual-Date Parameter],[Actual-Date])=0 AND [Actual-Date]<=[Actual-Date Parameter] )

      THEN ([PY Turnover]) end

 

In powerBI, I understand that I'll have to use tables instead of [Actual-Date Parameter], but I'm still unable to write the expression.

 Also, Can I somehow make a single select filter?

Just for background:

What I want to do with this expression is that, when a user clicks on a certain month, it should give a YTD value up until that month.

so 'Feb' would give me Jan+Feb

'March' would give me Jan+Feb+March.

 

Any help would be appreciated.

Thanks.

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @Lisa_Brown,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create a measue and you could see the result:

Measure = CALCULATE(SUM(Table1[Sales]),FILTER(ALL('Table1'),'Table1'[Fisacl Month]<=SELECTEDVALUE('Table1'[Fisacl Month])))

2.PNG

 

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/q4195c2i00oqym9/Tableau%20expresstion%20to%20DAX.pbix?dl=0

 

Regards,

Daniel He

Community Support Team _ Daniel He
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
v-danhe-msft
Employee
Employee

Hi @Lisa_Brown,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Employee
Employee

Hi @Lisa_Brown,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create a measue and you could see the result:

Measure = CALCULATE(SUM(Table1[Sales]),FILTER(ALL('Table1'),'Table1'[Fisacl Month]<=SELECTEDVALUE('Table1'[Fisacl Month])))

2.PNG

 

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/q4195c2i00oqym9/Tableau%20expresstion%20to%20DAX.pbix?dl=0

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Stachu
Community Champion
Community Champion

in general for YTD calculation for a Measure you would use following syntax

Measure YTD =
CALCULATE ( [Measure], DATESYTD ( CalendarTable[Date] ) )

so depending on your data structure you would need to adjust the naming
in general I recommend reading this bit, it covers most essential DAX concepts
https://www.powerpivotpro.com/wp-content/uploads/2015/10/PowerPivotPro-Reference-Card.pdf

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.