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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
michellepace
Resolver III
Resolver III

Add Custom Column // use MOD( ) for values

Hi there.

 

If the value in AccNumber ends in 3 zeros, then the particular account is a "main account". Otherwise it is a "sub account". I'm trying to use the MOD( ) function as shown in the code below to populate my new column.

 

I get the Expression Error that "The Name 'MOD' wasn't recognised".

 

Can anyone tell me what I am doing wrong, please?

 

let
    Source = Odbc.DataSource("dsn=ROSVILLE_ODBC", [HierarchicalNavigation=true]),
    ROSVILLE_Database = Source{[Name="ROSVILLE",Kind="Database"]}[Data],
    LedgerMaster_Table = ROSVILLE_Database{[Name="LedgerMaster",Kind="Table"]}[Data],
    #"Removed Other Columns" = Table.SelectColumns(LedgerMaster_Table,{"FinancialCategory", "AccNumber", "AccDesc", "ReportWriterCategory", "NumberSubAccs", "BalanceThis01", "BalanceThis02", "BalanceThis03", "BalanceThis04", "BalanceThis05", "BalanceThis06", "BalanceThis07", "BalanceThis08", "BalanceThis09", "BalanceThis10", "BalanceThis11", "BalanceThis12", "BalanceThis13", "BalanceLast01", "BalanceLast02", "BalanceLast03", "BalanceLast04", "BalanceLast05", "BalanceLast06", "BalanceLast07", "BalanceLast08", "BalanceLast09", "BalanceLast10", "BalanceLast11", "BalanceLast12", "BalanceLast13", "Blocked", "TaxType", "DefaultTax"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Other Columns", {"FinancialCategory", "AccNumber", "AccDesc", "ReportWriterCategory", "NumberSubAccs", "Blocked", "TaxType", "DefaultTax"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Columns",{{"Attribute", "Period"}, {"Value", "Period Balance"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Sub GL Account", each if MOD([AccNumber],1000) = 0 then "is main" else "is a sub account")
in
    #"Added Custom"

Thanks in advance,

Michelle

1 ACCEPTED SOLUTION
Nathaniel_C
Community Champion
Community Champion

Hi @michellepace ,

Try Number.Mod ()

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Nathaniel_C
Community Champion
Community Champion

Hi @michellepace ,

Try Number.Mod ()

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @michellepace , just make sure AcctNumber is not text.

sub acct mod.PNG

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors