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

Show data in Matrix visual as Actuals for months completed and rest as forecast for future months

Hello Experts,

 

Please find my requirement. 

 

I will receive actual every month (Screenshot1), however I must consider only till last month (i.e Month(now)-1) which should be dynamic. Also I will receive forecast (as in Screenshot2)

 

Requirement is in last screenshot. Till P01 to P04 Actual Data(40) and from P05 to P12 forecast Data(60) 
and finally total of Actual and forecast(100).

 

Actual Data every month will be updatedActual Data every month will be updatedForecast Data every month will be reduced month by month till it reaches P12Forecast Data every month will be reduced month by month till it reaches P12required output in Power BIrequired output in Power BI

 

 

 

 

 

I have wrote DAX Measures, however its not showing correct output.
I'm not sure where is my logic need to be changed, As its calculating both Actual and forecast(102) or calculating only Forecast(60). Its not giving 100

 

 

PowerBI_output2.PNGPowerBI_output1.PNG

 

 

 

 

 

 

URL to download PBIX and xlxs

 

 

Cheers,
Nawal

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @snawalkishore

 

You may add a month number column for actual table as below. Then you may get the value with a measure. Here is the sample file for your reference.

MonthNo = MONTH(DATEVALUE(Actual[MonthName]&"/1"))
Measure =
CALCULATE (
    SUM ( Actual[Hours] ),
    FILTER (
        Actual,
        Actual[MonthNo]
            <= MONTH ( NOW () ) - 1
            && Actual[Type] = "Actual"
            || Actual[Type] = "Forecast"
    )
)

Regards,

Cherie

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

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @snawalkishore

 

You may add a month number column for actual table as below. Then you may get the value with a measure. Here is the sample file for your reference.

MonthNo = MONTH(DATEVALUE(Actual[MonthName]&"/1"))
Measure =
CALCULATE (
    SUM ( Actual[Hours] ),
    FILTER (
        Actual,
        Actual[MonthNo]
            <= MONTH ( NOW () ) - 1
            && Actual[Type] = "Actual"
            || Actual[Type] = "Forecast"
    )
)

Regards,

Cherie

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

Hi,

maybe you should extract the numeric month value with Power Query and filter on it.

 

Sample:

 

let
    Source = Excel.Workbook(File.Contents("C:\xxx\Test.xlsx"), null, true),
    Actual_Sheet = Source{[Item="Actual",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Actual_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"MonthName", type text}, {"Month", type text}, {"Hours", type number}, {"Type", type text}}),
    #"Inserted Last Characters" = Table.AddColumn(#"Changed Type", "Last Characters", each Text.End([Month], 2), type text),
    #"Changed Type1" = Table.TransformColumnTypes(#"Inserted Last Characters",{{"Last Characters", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Last Characters", "Month Digit"}}),
    #"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Month Digit] < Date.Month(DateTime.LocalNow()) -1)
in
    #"Filtered Rows"

If I answered your question, please mark my post as solution, this will also help others.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


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