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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
praveenlc
Helper I
Helper I

find weekly variance of heirarchy measure at category level and sub-category

Hello, I am trying to find weekly varaince at each category level and sub-category level (CurrentWeek-PreviousWeek)/PreviousWeek

The challange is when I hide 0 values from the metrix table the calculation gives different results, I have used FILTER(), ISINSCOPE() and ALLEXCEPT to achieve the measures

 

In my example:

- for category 'cbf-cloudservices-prd' previous week=6770.06 and current week=1182.48 and varaince is -82.53%

- but when I apply variance <> blank(), then the values change to subcategory values (4613.13, 745.20, 83.85%)

 

attaching the image and dax measure, could someone please help me undertand fix the problem.

IMG2.JPGIMG3.JPG

MEASURE1:_CurrWeek AZ cost= SWITCH(TRUE(), ISINSCOPE('df Usage'[MeterCategory]),
CALCULATE (
    [Azure Cost],
    FILTER (
        ALL ( MasterCalendar ),
                 MasterCalendar[YearWeek]= MAX ( MasterCalendar[YearWeek] )
    ))
, ISINSCOPE(SingleSourceOfTruth_Actuals[SubscriptionName]),
CALCULATE (
    [Azure Cost],
    FILTER (
        ALL ( MasterCalendar ),
MasterCalendar[YearWeek]= MAX ( MasterCalendar[YearWeek] )
    ),ALLEXCEPT(SingleSourceOfTruth_Actuals,SingleSourceOfTruth_Actuals[SubscriptionName])),0)
MEASURE2:_PrevWeek AZ cost1 = SWITCH(TRUE(), ISINSCOPE('df Usage'[MeterCategory]),
CALCULATE (
    [Azure Cost],
    FILTER (
        ALL ( MasterCalendar ),
           MasterCalendar[YearWeek] = MAX ( MasterCalendar[YearWeek] ) - 1))
, ISINSCOPE(SingleSourceOfTruth_Actuals[SubscriptionName]),
CALCULATE (
    [Azure Cost],
    FILTER (
        ALL ( MasterCalendar ),
            MasterCalendar[YearWeek] = MAX ( MasterCalendar[YearWeek] ) - 1
    ),ALLEXCEPT(SingleSourceOfTruth_Actuals,SingleSourceOfTruth_Actuals[SubscriptionName])),0)
MEASURE3VARIANCE:_Weekly Variance Azure Cost 1 % =
IF (
    [_CurrWeek AZ cost] > 500
        || ([_CurrWeek AZ cost] > [_PrevWeek AZ cost1]
        && [_PrevWeek AZ cost1] > 200),
    DIVIDE (
        [_CurrWeek AZ cost]-[_PrevWeek AZ cost1],
        CALCULATE([_PrevWeek AZ cost1]),0))

 

3 REPLIES 3
v-xuxinyi-msft
Community Support
Community Support

Hi @praveenlc 

 

Can you provide the exact data and data structure? How to provide sample data in the Power BI Forum - Microsoft Fabric Community

We can better understand the problem and help you. Or Show them as screenshots. Please remove any sensitive data in advance.

 

Best Regards,
Community Support Team _Yuliax

 

praveenlc
Helper I
Helper I

how do I exclude the blank rows (red marked) without changing the yellow highlighted category values, filters on subcategory should not effect the values from category
IMG4.JPG

praveenlc
Helper I
Helper I

any help would be greatly appreciated, please let me know if any more details required

 

Thanks in advance

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 MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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