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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
immkhan
Frequent Visitor

How to calculate Growth based on multiple dimension

Hi

 

I want to calculate Growth for Current year (Month over Month), Growth over last year and Five Year Growth. The dimension to calculate growth is multiple.

1) Company , Country, Customer, Product, Year, Quarter, Month etc.

 

Any simple way to do it...
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @immkhan 

 

Based on your description, I created data to reproduce your scenario.

a1.png

 

Test:

a2.png

 

Calendar:

 

Calendar = CALENDARAUTO()

 

 

There is a one-to-one relationship between two 'Calendar' and 'Table'.

 

You may create a measure as below.

 

PeriodValue = 
var _period = SELECTEDVALUE(Test[Period])
return
IF(
    _period = "Current year",
    CALCULATE(
        SUM('Table'[Value]),
        DATESYTD('Calendar'[Date])
    ),
    IF(
        _period = "Last year",
        CALCULATE(
            SUM('Table'[Value]),
            DATESYTD(SAMEPERIODLASTYEAR('Calendar'[Date]))
        ),
        IF(
            _period = "Last five years",
            CALCULATE(
                SUM('Table'[Value]),
                DATESINPERIOD(
                    'Calendar'[Date],
                    LASTDATE('Calendar'[Date]),
                    -5,
                    YEAR
                )
            )
        )
    )
)

 

 

 

 

You may also use other dimensions as slicers to filter the result. Here are the results.

a3.png

 

a4.png

 

a5.png

 

Best Regards

Allan

 

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

7 REPLIES 7
v-alq-msft
Community Support
Community Support

Hi, @immkhan 

 

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

 

Best Regards

Allan

Actually it is not giving the desired result which I want and therefore I have not marked as a complete solution.

 

Anyways you marked it as a solution and closes the thread.

 

Regards

Anonymous
Not applicable

To create a quick measure in Power BI Desktop, right-click or select the ellipsis ... next to any item in the Fields pane, and select New quick measure from the menu that appears.

Select New quick measure

You can also right-click or select the drop-down arrow next to any value in the Values well for an existing visual, and select New quick measure from the menu.

When you select New quick measure, the Quick measures window appears, letting you select the calculation you want and the fields to run the calculation against.

Select the Select a calculation field to see a long list of available quick measures.

v-alq-msft
Community Support
Community Support

Hi, @immkhan 

 

Based on your description, I created data to reproduce your scenario.

a1.png

 

Test:

a2.png

 

Calendar:

 

Calendar = CALENDARAUTO()

 

 

There is a one-to-one relationship between two 'Calendar' and 'Table'.

 

You may create a measure as below.

 

PeriodValue = 
var _period = SELECTEDVALUE(Test[Period])
return
IF(
    _period = "Current year",
    CALCULATE(
        SUM('Table'[Value]),
        DATESYTD('Calendar'[Date])
    ),
    IF(
        _period = "Last year",
        CALCULATE(
            SUM('Table'[Value]),
            DATESYTD(SAMEPERIODLASTYEAR('Calendar'[Date]))
        ),
        IF(
            _period = "Last five years",
            CALCULATE(
                SUM('Table'[Value]),
                DATESINPERIOD(
                    'Calendar'[Date],
                    LASTDATE('Calendar'[Date]),
                    -5,
                    YEAR
                )
            )
        )
    )
)

 

 

 

 

You may also use other dimensions as slicers to filter the result. Here are the results.

a3.png

 

a4.png

 

a5.png

 

Best Regards

Allan

 

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

can you share that sample .pbix file

Hi, @immkhan 

 

Here is the pbix .

Best Regards

Allan

 

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

amitchandak
Super User
Super User

@immkhan 

Use time intelligence with date calendar

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
last QTR same Month (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,Qtr))))
MTD (Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR('Date'[Date])))
MTD (Last Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR(dateadd('Date'[Date],-12,MONTH),"8/31")))

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))

Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))
Last complete QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))

Last to last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-2,QUARTER)))
Next QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],1,QUARTER)))

Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,Year)))
Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER(dateadd('Date'[Date],-1,Year))))

trailing QTR = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,QUARTER))
trailing  4 QTR = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-4,QUARTER))



YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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