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
manojk_pbi
Helper III
Helper III

How to get Change in Percentage with respect to Base line data

Hi Friends,

 

I am looking for a DAX measure to calculate Change in Percentage w.r.t to a particular period by Products. Please suggest me how can we write the optimized DAX for the same. Provided a sample with required output. Baseline is Jan-23 data, this can vary as per business request. Any suggestions are much appreciated.

MY            Product   Qty          %Change

Jan-23PROD1100 
Feb-23PROD112020%
Mar-23PROD113535%
Apr-23PROD114040%
May-23PROD112020%
Jun-23PROD11000%
Jul-23PROD180-20%
Aug-23PROD190-10%
Sep-23PROD175-25%
Oct-23PROD11000%
Nov-23PROD180-20%
Dec-23PROD165-35%

 

Thanks

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

Hi, @manojk_pbi 

Based on your description, I used the following sample data:

vjianpengmsft_0-1711685664597.png

I created a table visual as shown in the image below:

vjianpengmsft_1-1711685752670.png

I created a measure with the following DAX:

Percentage =
VAR _minday =
    CALCULATE ( MIN ( 'Table'[MY] ), ALL ( 'Table' ) )
VAR _mindayQty =
    CALCULATE (
        MIN ( 'Table'[Qty] ),
        FILTER ( ALL ( 'Table' ), 'Table'[MY] = _minday )
    )
RETURN
    IF (
        MIN ( 'Table'[MY] ) = _minday,
        BLANK (),
        DIVIDE ( SUM ( 'Table'[Qty] ) - _mindayQty, _mindayQty )
    )

vjianpengmsft_2-1711685867483.png

Put this measure into the table visual, and the result is as follows:

vjianpengmsft_3-1711685945035.png

I've provided the PBIX file for this time below, and it would be great if I could help you.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

5 REPLIES 5
v-jianpeng-msft
Community Support
Community Support

Hi, @manojk_pbi 

Based on your description, I used the following sample data:

vjianpengmsft_0-1711685664597.png

I created a table visual as shown in the image below:

vjianpengmsft_1-1711685752670.png

I created a measure with the following DAX:

Percentage =
VAR _minday =
    CALCULATE ( MIN ( 'Table'[MY] ), ALL ( 'Table' ) )
VAR _mindayQty =
    CALCULATE (
        MIN ( 'Table'[Qty] ),
        FILTER ( ALL ( 'Table' ), 'Table'[MY] = _minday )
    )
RETURN
    IF (
        MIN ( 'Table'[MY] ) = _minday,
        BLANK (),
        DIVIDE ( SUM ( 'Table'[Qty] ) - _mindayQty, _mindayQty )
    )

vjianpengmsft_2-1711685867483.png

Put this measure into the table visual, and the result is as follows:

vjianpengmsft_3-1711685945035.png

I've provided the PBIX file for this time below, and it would be great if I could help you.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

v-jianpeng-msft
Community Support
Community Support

Hi, @manojk_pbi 

Your solution is great, @bhanu_gautam . It worked like a charm! Has your problem been solved? 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

 

 

bhanu_gautam
Super User
Super User

Try creating measure and pull that into visuals





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




bhanu_gautam
Super User
Super User

@manojk_pbi , You can try using below measure

 

%Change =
VAR BaselineQty = CALCULATE(SUM(Table1[Qty]), FILTER(ALL(Table1), Table1[MY] = "Jan-23"))
VAR CurrentQty = SUM(Table1[Qty])
RETURN
IF(
BaselineQty <> 0,
DIVIDE(CurrentQty - BaselineQty, BaselineQty),
BLANK()
)

 

Please accept as solution and give kudos if it helps





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @bhanu_gautam , thanks for quick response.

 

Where can i use this measure, should i be creating the column in the table or use the measure directly into charts ? How will this consider product filter ? Data i am looking at Product level

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.

Top Solution Authors