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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
msksenthil
Helper III
Helper III

M code - Functions: type Function to number

Friends, I try to call one function in to the other kind of nested.

 

M-Code:

let

ADD = (x as any) => let s2 = x+1
in
s2,

SUB = let s33 = ADD -1
in
s33
in
SUB

 

ERROR:

msksenthil_0-1621437641905.png

 

Thanks in advance

 

7 REPLIES 7
msksenthil
Helper III
Helper III

@Greg_Deckler @Anonymous Many thanks both of you. The below code is working fine to me

 

let

ADD = (x as any) => let s2 = x+4
in
s2,

SUB =(x as any) => let s33 = ADD(x) -3
in
s33
in
SUB

Greg_Deckler
Community Champion
Community Champion

@msksenthil I would still do it as 2 functions:

 

let
ADD = (x as any) => let s2 = x+1
in
s2
in
ADD



let
SUB = (x as any) => let s33 = ADD(x)-1
in
s33
in
SUB

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

You need to complete your ADD function. After you have in s2 , you have to write in ADD. right now, ADD is unevaluated function -1. 

Greg_Deckler
Community Champion
Community Champion

@msksenthil Perhaps I'm mistaken but don't you want 2 separate functions:

 

let
ADD = (x as any) => let s2 = x+1
in
s2
in
ADD



let
SUB = (x as any) => let s33 = x+1
in
s33
in
SUB

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Nope, I try to use the result of the previous 'let' in the following 'let'

Anonymous
Not applicable

Instead of "in s2", try "in s2 in ADD".

--Nate

Sorry, I didn't get you

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors