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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Rachel_123
Helper I
Helper I

Please help converting DAX to M

Hi, I've been struggling with a problem for awhile and finally found a workaround but to implement the solution I need to create a table in Power query in M, can anyone help me please translate the following dax to M:

 

Projects Summary = SUMMARIZE('Portfolio Reporting','Portfolio Reporting'[Project],'Portfolio Reporting'[Expense Type], 'Portfolio Reporting'[Date],"Actuals",CALCULATE(sum('Portfolio Reporting'[Value]),'Portfolio Reporting'[Versions] IN { "Actuals" }),"Current Budget", CALCULATE(SUM('Portfolio Reporting'[Value]),'Portfolio Reporting'[Versions] IN { "Current Budget" }),"Current Forecast",CALCULATE( SUM('Portfolio Reporting'[Value]),'Portfolio Reporting'[Versions] IN { "Current Fcst" }))
 
Thank you!
1 ACCEPTED SOLUTION

somebody gave me a script that worked

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Project", "Expense Type", "Date"}, {
    {"Actuals", each List.Sum(Table.SelectRows(_, each [Versions] = "Actuals")[Value])},
    {"Current Budget", each List.Sum(Table.SelectRows(_, each [Versions] = "Current Budget")[Value])},
    {"Current Forecast", each List.Sum(Table.SelectRows(_, each [Versions] = "Current Fcst")[Value])}
    })
in #"Grouped Rows"


 

View solution in original post

4 REPLIES 4
JoZu
Frequent Visitor

Could you please provide some sample data with expected results. I think it would make it easier to find a working solution.

Best regards

somebody gave me a script that worked

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Project", "Expense Type", "Date"}, {
    {"Actuals", each List.Sum(Table.SelectRows(_, each [Versions] = "Actuals")[Value])},
    {"Current Budget", each List.Sum(Table.SelectRows(_, each [Versions] = "Current Budget")[Value])},
    {"Current Forecast", each List.Sum(Table.SelectRows(_, each [Versions] = "Current Fcst")[Value])}
    })
in #"Grouped Rows"


 

JoZu
Frequent Visitor

Hi @Rachel_123 

 

Try the following:

let
    Source = #"Portfolio Reporting",
    #"Grouped Rows" = Table.Group(Source, {"Project", "Expense Type", "Date"}, {{"Actuals", each List.Sum(List.Select([Value], each [Versions] = "Actuals")), type nullable number}, {"Current Budget", each List.Sum(List.Select([Value], each [Versions] = "Current Budget")), type nullable number}, {"Current Forecast", each List.Sum(List.Select([Value], each [Versions] = "Current Fcst")), type nullable number}})
in
    #"Grouped Rows"

 

I dont have any data to try it, sorry. But let me know if it works 🙂

Best regards

Thank you so much, so this works for all the columns except the ones we are summarizing (Actuals, Current budget and Current forecast) I get error on those, something about cannot apply field access
error1.PNG

Rachel_123_0-1681312211245.png

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.