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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
N-msft
Frequent Visitor

Monthly figures and QTD, YTD, MTD on same matrix visual

Hi,

 

I am wondering if this can be achieved in PBI.

 

How can I bring in the data for last 6 months and showing MTD/QTD/YTD performance as well in a single table or matrix visual.

 

CategoriesJan 2023Feb 2023Mar 2023Apr 2023May 2023Jun 2023MTD ActualMTD PlannedVarianceYTD ActualYTD PlannedVariance
Travel3334655977298619931125340-78551032380-2723
Home2302342382422467741302320-98232662240-1026
Office2036573211349487625300-3252013210087
Outdoor123671132287492897350-54719992450451

 

 

Appreciate your help in this matter.

 

 

1 ACCEPTED SOLUTION

HI @N-msft ,

You cna create a table with last date range string and add cusomt field vlaue QTD, YTD, MTD wiht index as sort by column properity.

1.png

Measure formula to check current category and period and redirect to different expressions: (current I put some placehoder in it, you can replace them to correspond expressions)

formula =
VAR currPeriod =
    SELECTEDVALUE ( NewTable[Period] )
VAR currCategory =
    SELECTEDVALUE ( 'Table'[Category] )
RETURN
    SWITCH (
        currPeriod,
        "MTD Actual", 100,
        "MTD Planned", 101,
        "QTD Actual", 200,
        "QTD Planned", 201,
        "YTD Actual", 300,
        "YTD Planned", 301,
        YEAR ( DATEVALUE ( currPeriod ) ) * 100
            + MONTH ( DATEVALUE ( currPeriod ) )
    )

2.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @N-msft,

You can create a new table with all months and custom period groups to use on matrix visual column field and replace the original table field.

Then you can wire a measure formula with SELECTEDVALUE and SWITCH functions to check the current row and column value as condition to look up and redirect to the different calculation.

Solved: Re: DAX SWITCH + SELECTEDVALUE() - Microsoft Fabric Community

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks @v-shex-msft ,

 

Can you elaborate on it little further as I sucks at DAX? May be by showing an example.

 

 

 

HI @N-msft ,

You cna create a table with last date range string and add cusomt field vlaue QTD, YTD, MTD wiht index as sort by column properity.

1.png

Measure formula to check current category and period and redirect to different expressions: (current I put some placehoder in it, you can replace them to correspond expressions)

formula =
VAR currPeriod =
    SELECTEDVALUE ( NewTable[Period] )
VAR currCategory =
    SELECTEDVALUE ( 'Table'[Category] )
RETURN
    SWITCH (
        currPeriod,
        "MTD Actual", 100,
        "MTD Planned", 101,
        "QTD Actual", 200,
        "QTD Planned", 201,
        "YTD Actual", 300,
        "YTD Planned", 301,
        YEAR ( DATEVALUE ( currPeriod ) ) * 100
            + MONTH ( DATEVALUE ( currPeriod ) )
    )

2.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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