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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Show Variance% only till both column values are present

Hello,

 

I Have below chart

current Chart.jpg

 

Sample Data:

Data Example.jpg

 

I am struggling to correct below DAX to display chart as shown below.

 

DAX.jpg

 

I would like to show variance% only  IF(((YearCount=2)&&(NOT(ISBLANK(SecondSelectedValue))), DIVIDE(SecondSelectedValue - FirstSelectedValue, FirstSelectedValue )) as I have 2020 data only till today(2020-05-W2)

 

I need to display Variance% as shown in the below chart.

expected chart.jpg

 

Please let me know how to correct above DAX to display Variance% only till current week

 

Thank you!

 

 

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

HI  @Anonymous 

Add a conditional in the formula as below:

    IF (
        (
            ( YearCount = 2 )
                && ( NOT ( ISBLANK ( SecondSelectedValue*FirstSelectedValue ) ) )
        ),
        DIVIDE ( SecondSelectedValue - FirstSelectedValue, FirstSelectedValue )
    )

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-lili6-msft ,

 

Thank you for your reply!

 

I have updated the formula as per your suggestion. It didn't work.

 

Bill Variance % =
VAR YearCount= CALCULATE(COUNTROWS(FILTERS('Weekly WAMR vs Pumpage'[Year])),ALLSELECTED('Weekly WAMR vs Pumpage'[Year]))
VAR Top1N =
    VALUE (
        CALCULATE (
            CONCATENATEX ( TOPN ( 1, VALUES ( 'Weekly WAMR vs Pumpage'[Year] ) ), 'Weekly WAMR vs Pumpage'[Year], ", " )
        )
    )
VAR Top2N =
    VALUE (
        CALCULATE (
            CONCATENATEX (
                TOPN ( 1, VALUES ( 'Weekly WAMR vs Pumpage'[Year] ), 'Weekly WAMR vs Pumpage'[Year], DESC ),
                'Weekly WAMR vs Pumpage'[Year],
                ", "
            )
        )
    )
VAR FirstSelectedValue =
    CALCULATE ( SUM ( 'Weekly WAMR vs Pumpage'[AVG_BILL_CONS_MGD] ), 'Weekly WAMR vs Pumpage'[Year] = Top1N )
VAR SecondSelectedValue =
    CALCULATE ( SUM ( 'Weekly WAMR vs Pumpage'[AVG_BILL_CONS_MGD] ), 'Weekly WAMR vs Pumpage'[Year] = Top2N )
RETURN IF(
          (
           (YearCount=2)
              &&(NOT(ISBLANK(SecondSelectedValue*FirstSelectedValue)))
           ),
           DIVIDE(SecondSelectedValue - FirstSelectedValue, FirstSelectedValue )
       )

 

Still Variance% line is showing in the chart for upcoming weeks as 0%.

 

Variance issue.jpg

 

hi  @Anonymous 

If possible, could you please share your sample pbix file for us have a test, that will be a great help.

 

 Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-lili6-msft ,

 

I do not see any option to attach .pbix file or excel file here.

Anonymous
Not applicable

Please let me know how to attach .pbix file and excel file here.

 

Thank you!

 

Regards,

Aswini

hi @Anonymous 

You can upload it to OneDrive for business and post the link here. Do mask sensitive data before uploading.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors