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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ShyamS
Frequent Visitor

Need help in converting below tableau formula to power bi

Hello All,

It will be very helpful if anyone can help me out to convert this tableau formula to power bi measure.

SUM((FIXED DATEPART('quarter', [Calendar Day)), DATEPART('year', [Calendar Day]): SUM(IF DATEPART('quarter', [Calendar Day]) = DATEPART('quarter', [Current Day MY]-1) and DATEPART('year', [Calendar Day)) DATEPART('year', [Current Day MY]-1) THEN [WORKING DAY YTD] END))).

Thank you in advance for your quick response and valuable time.

2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @ShyamS 

 

Thanks for the reply from @Greg_Deckler , please allow me to provide another insight:

Here's a DAX formula that should provide the equivalent functionality:

Measure =
VAR CurrentQuarter =
    QUARTER ( MAX ( 'Table'[Current Day MY] ) ) - 1
VAR CurrentYear =
    YEAR ( MAX ( 'Table'[Current Day MY] ) )
VAR PreviousQuarterEnd =
    IF (
        CurrentQuarter = 0,
        DATE ( CurrentYear - 1, 12, 31 ),
        EDATE ( DATE ( CurrentYear, CurrentQuarter * 3, 1 ), -1 )
    )
VAR PreviousQuarterStart =
    EDATE ( PreviousQuarterEnd, -2 )
RETURN
    CALCULATE (
        SUM ( 'Table'[WORKING DAY YTD] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Calendar Day] >= PreviousQuarterStart
                && 'Table'[Calendar Day] <= PreviousQuarterEnd
        )
    )

Please note, you might need to adjust the table and column names () to match your actual data model in Power BI.

 

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

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

Greg_Deckler
Super User
Super User

@ShyamS Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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