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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

Hi @Anonymous ,

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
Anonymous
Not applicable

Hi @Anonymous ,

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors