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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.