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

October 28 & 29: Experts share their secrets on how to pass the Fabric Analytics Engineer certification exam—live. Learn more

Reply
heetu24
Helper I
Helper I

DAX

I have 3 column in the table

 

Product name,

Year(where Current year, last year  and last two year this format year mention)

Sales value(In this column each year sales record present)

I want create  calculated column of % Change  sales..

 

Any one provide DAX

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

Hi @heetu24 ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? Thank you.

Best Regards

Community Support Team _ Rena
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

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @heetu24 ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? Thank you.

Best Regards

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

Hi @heetu24 ,

You can create a calculated column as below to get it:

% Change Sales = 
VAR _product = 'Table'[Product name]
VAR _year = 'Table'[Year]
VAR _cursales = 'Table'[Sales value]
VAR _pysales =
    CALCULATE (
        SUM ( 'Table'[Sales value] ),
        FILTER (
            'Table',
            'Table'[Product name] = _product
                && 'Table'[Year] = _year - 1
        )
    )
RETURN
    IF (
        NOT ( ISBLANK ( _pysales ) ),
        DIVIDE ( ( _cursales - _pysales ), _pysales ),
        BLANK ()
    )

vyiruanmsft_0-1721180235788.png

Best Regards

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

I am getting the error the record in item column can not convert from text to true false

Hi @heetu24 ,

It seems like there is some problem in the formula of your calculated column, could you please provide the screenshot with the error message? And provide some raw data in your table (exclude sensitive data) with Text format. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

October NL Carousel

Fabric Community Update - October 2024

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