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
Marsfield2019
New Member

Calcualte actual and forecast with dynamic measure selection

Hidata source.JPG

I would like to build a report which is able to select the different versions from below table.

I duplicated the version into new table with heading "Reporting" and Comparative “with version.

Then I write the below measure to calculate the Current month and prior month.

Current Month = TOTALMTD(SUM([amount], Date[Period],FilterS[Reporting]

Prior Month = TOTALMTD(SUM([amount], Date[Period],FilterS[Comparative]

Budget Month will be different version.

I would expect the Current Month amount will be $550 if I select the reporting version = ‘Working’  with period “Sep” in the filter.

The Prior month will be $120 if I select reporting version = ‘Jul 2019 version’ with period “Sep”

Then I can work on the Var = Current month – Last Month

My question is how can build the dynamic  DAX?

Thanks in advance

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

Hi @Marsfield2019 ,

 

How about the result after you follow the suggestions mentioned in my original post?

 

Best regards,

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

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

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @Marsfield2019 ,

 

How about the result after you follow the suggestions mentioned in my original post?

 

Best regards,

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

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

Hi @Marsfield2019 ,

 

We use the following measure to archive your requirement:

 

Current Month = SUM('Dates'[Amount])
Prior Month = 
SUMX (
    FILTER (
        ALL ( 'Dates' ),
        Dates[Version] = SELECTEDVALUE ( Dates[Version] )
            && Dates[Date-Year-Month]
                >= SELECTEDVALUE ( Dates[Date-Year-Month] ) - 31
            && Dates[Date-Year-Month] < SELECTEDVALUE ( Dates[Date-Year-Month] )
    ),
    [Amount]
)

But based on the fact that you have a date column in your table, we could create a calculated date column using following formula:

 

MonthNumber = SWITCH([Period],"Jul",7,"AUG",8,"Sep",9) 
-- Add more based on your short name
Date-Year-Month = DATE([YEAR],[MonthNumber],1)

But if you already have one, you can skip these steps

 

15.PNG16.PNG

 

 

 

BTW, pbix as attached.

 

Best regards,

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

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

Hi

I am sorry for late reply as I was busy on Month end reporting.

How about the comparsion?

I would like to know the var of September  between  "Working version" and "Jul version?

 

Thanks in advance

Hi @Marsfield2019 ,

 

Firstly, Create two calculate table contain all the version value and put them into two slicers:

 

VersionSelect-1 = DISTINCT('Dates'[Version])

 

VersionSelect-2 = DISTINCT('Dates'[Version])

Then we can create two measures to show the value based on the slicers

 

 

SelectedMonthVersion1 =
SUMX (
    FILTER (
        ALL ( Dates ),
        AND (
            'Dates'[Version] IN FILTERS ( 'VersionSelect-1'[Version] ),
            'Dates'[Period] IN FILTERS ( 'Dates'[Period] )
        )
    ),
    [Amount]
)

 

SelectedMonthVersion2 =
SUMX (
    FILTER (
        ALL ( Dates ),
        AND (
            'Dates'[Version] IN FILTERS ( 'VersionSelect-2'[Version] ),
            'Dates'[Period] IN FILTERS ( 'Dates'[Period] )
        )
    ),
    [Amount]
)

1.PNG

 


BTW, pbix as attached.

 

Best regards,

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

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

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.