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

Help improving meassure

Hello!

 

I have a meassure called "Increased Sales"
It needs to show the sales of the chanels that sold more than the last year

For that, I have the following meassure:

 

Increased Sales=
CALCULATETABLE (
    ADDCOLUMNS (
        VALUES ( 'DB'[Chanel] ),
        "Increase",
            IF (
                'Measures Table'[Sales]
                    > CALCULATE (
                        'Measures Table'[Sales],
                        SAMEPERIODLASTYEAR ( 'Date'[Date] )
                    )
                    && [Sales] > 0,
                [Sales],
                0
            )
    )

)

 

I would like some advice on how to improve it, and also how to exclude the chanels that did not grow over the last year, so that they won't be shown in the table with a 0... I need to exclude them...

 

Any ideas?

 

Thanks a lot!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try measure like

 

Increase =Var _1 = [sales]
var _2 = calculate([sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
return
Switch(True() ,
_1 >0 && [_1] >[_2], "Increase" ,
Blank())

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@amitchandak  thanks a lot!
The meassure above gives me a list of the the chanels that increased sales followed by the word increased, when I put it in a table visualization

 

I would like the table to show the chanels that have increase sales and on other column, the sales

 

How can I moddify the meassure to do it?

amitchandak
Super User
Super User

@Anonymous , Try measure like

 

Increase =Var _1 = [sales]
var _2 = calculate([sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
return
Switch(True() ,
_1 >0 && [_1] >[_2], "Increase" ,
Blank())

Anonymous
Not applicable

@amitchandak  do you know why it does't work with calculation groups of time intelligence?

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.