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

DAX selecting from Quarter Column the current Quarter to find out the QTD.

I have a table with several columns, 1 of them is Quarter and the values are Q1, Q2, Q3, Q4.

I need to fix my DAX to select the current QTD value from the Quarter column in the filter (instead of manually changing them every time).

 

Weekly Pacing Target = Calculate(SUM('TABLE'[Budget])/12, FILTER( TABLE,'TABLE'[Year]=2018 && 'TABLE'[Quarter]="Q3"))
 
So instead of having Q3 there what should I have to automatically take the current Quarter , in this case Q4? 
 
 
Also here:
 
 
TARGETX=
CALCULATE(sum(TABLE[Budget])*
(DATEDIFF(DATE(2022,7,1),TODAY(),DAYDATEDIFF(DATE(2022,7,1),DATE(2022,9,30),DAY)), TABLE[Channel]= "Twitter", TABLE[Quarter] = "Q4", TABLE[Year]=2022)
 
instead of having like to manually choose Quarter and Year i need to it to automatic please someone help.
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @CharlesMS ,

Please have a try.

Create measures.

Weekly Pacing Target =
VAR _1 =
    "Q" & QUARTER ( TODAY () )
RETURN
    CALCULATE (
        SUM ( 'TABLE'[Budget] ) / 12,
        FILTER ( TABLE, 'TABLE'[Year] = 2018 && 'TABLE'[Quarter] = _1 )
    )

 

TARGETX =
VAR _1 =
    "Q" & QUARTER ( TODAY () )
RETURN
    CALCULATE (
        SUM ( TABLE[Budget] )
            * (
                DATEDIFF ( DATE ( 2022, 7, 1 ), TODAY (), DAY )
                    / DATEDIFF ( DATE ( 2022, 7, 1 ), DATE ( 2022, 9, 30 ), DAY )
            ),
        TABLE[Channel] = "Twitter",
        TABLE[Quarter] = _1,
        TABLE[Year] = 2022
    )

 

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

 

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

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @CharlesMS ,

Please have a try.

Create measures.

Weekly Pacing Target =
VAR _1 =
    "Q" & QUARTER ( TODAY () )
RETURN
    CALCULATE (
        SUM ( 'TABLE'[Budget] ) / 12,
        FILTER ( TABLE, 'TABLE'[Year] = 2018 && 'TABLE'[Quarter] = _1 )
    )

 

TARGETX =
VAR _1 =
    "Q" & QUARTER ( TODAY () )
RETURN
    CALCULATE (
        SUM ( TABLE[Budget] )
            * (
                DATEDIFF ( DATE ( 2022, 7, 1 ), TODAY (), DAY )
                    / DATEDIFF ( DATE ( 2022, 7, 1 ), DATE ( 2022, 9, 30 ), DAY )
            ),
        TABLE[Channel] = "Twitter",
        TABLE[Quarter] = _1,
        TABLE[Year] = 2022
    )

 

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

 

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.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.