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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Comparative Figures by Period

I have a question regarding comparative figures. Essentially I am building highlevel Card visuals that show Revenue numbers for example.

 

Currently these Card visuals show Total Revenue based on three filters - 1. Financial Year, 2. Month and 3. MTD, QTD or YTD, depending on what the user wants to see. Also note that the data set contains 10 years worth of data.

 

What I am looking to do, is show a comparative number next to the existing card visual, based on the same three filters as mentioned above. Based on the Financial Year and Month selected, I want the comparatives to show as follows based on the third filter. If:

YTD, then show comparative month a year ago (e.g. Mar2018 YTD vs March2017 YTD)

QTD, then show comparative with prior quarter (e.g. Mar2018 QTD vs Dec2017 QTD)

MTD, then show comparative with prior month (e.g Mar2018 MTD vs Feb2018 MTD)

 

I have tried doing this (just for a single comparative for now) with the following measure, however I get a big round X in my visual.

 

YTDComparative = if ( isfiltered('Period Selector'[Period])="YTD",

calculate([TotalRevenueVariable], parallelperiod('Calendar'[Date],-1,year))

,[TotalRevenueVariable])

 

TotalRevenueVariable is used to flip data between YTD, QTD and MTD based on the following measure:

 

TotalRevenueVariable = IF ( HASONEVALUE ('Period Selector'[Period]),
SWITCH ( VALUES ('Period Selector'[Period]),
"YTD", [TotalRevenueYTD],
"MTD", [TotalRevenueMTD],
"QTD", [TotalRevenueQTD]
)
,[TotalRevenueYTD])

 

Any thoughts on how I can create the dynamic comparative figures?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

Switch function cannot work properly on summarized records which contains multiple case items.


If you mean use switch function to analysis and split records to YTD, QTD, MTD from summary records, it is impossible. 

ISFILTERED function only return bool value, I think you have misunderstood for this fucntion. 

 

You can also try to use below formula if it works for your requirement.

 

TotalRevenueVariable =
IF (
    HASONEVALUE ( 'Period Selector'[Period] ),
    SWITCH (
        SELECTEDVALUE ( 'Period Selector'[Period] ),
        "YTD", [TotalRevenueYTD],
        "MTD", [TotalRevenueMTD],
        "QTD", [TotalRevenueQTD]
    ),
    [TotalRevenueYTD]
)

YTDComparative =
IF (
    SELECTEDVALUE ( 'Period Selector'[Period] ) = "YTD",
    CALCULATE (
        [TotalRevenueVariable],
        PARALLELPERIOD ( 'Calendar'[Date], -1, YEAR )
    ),
    [TotalRevenueVariable]
)

 

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

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

Switch function cannot work properly on summarized records which contains multiple case items.


If you mean use switch function to analysis and split records to YTD, QTD, MTD from summary records, it is impossible. 

ISFILTERED function only return bool value, I think you have misunderstood for this fucntion. 

 

You can also try to use below formula if it works for your requirement.

 

TotalRevenueVariable =
IF (
    HASONEVALUE ( 'Period Selector'[Period] ),
    SWITCH (
        SELECTEDVALUE ( 'Period Selector'[Period] ),
        "YTD", [TotalRevenueYTD],
        "MTD", [TotalRevenueMTD],
        "QTD", [TotalRevenueQTD]
    ),
    [TotalRevenueYTD]
)

YTDComparative =
IF (
    SELECTEDVALUE ( 'Period Selector'[Period] ) = "YTD",
    CALCULATE (
        [TotalRevenueVariable],
        PARALLELPERIOD ( 'Calendar'[Date], -1, YEAR )
    ),
    [TotalRevenueVariable]
)

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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