Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Your file has been submitted successfully. We’re processing it now - please check back in a few minutes to view your report.
05-10-2020 20:14 PM - last edited 05-10-2020 20:46 PM
In my recent quest to create or catalog as many DAX equivalents for Excel functions , ARABIC converts numbers written in the Roman numeral system to numbers written in the Arabic numeral system, just in case you have to convert that EBCIDIC encoded mainframe data from those COBOL programs that store 2-digit years written as Roman numerals...
ARABIC =
VAR __Roman = MAX([ROMAN])
VAR __Classic =
DATATABLE(
"Arabic",INTEGER,
"Roman",STRING,
{
{ 1, "I" },
{ 4, "IV" },
{ 5, "V" },
{ 9, "IX" },
{ 10, "X" },
{ 40, "XL" },
{ 50, "L" },
{ 90, "XC" },
{ 100, "C" },
{ 400, "CD" },
{ 500, "D" },
{ 900, "CM" },
{ 1000, "M" }
}
)
VAR __Convert = __Classic
VAR __Table =
ADDCOLUMNS(
ADDCOLUMNS(
GENERATESERIES(1,LEN(__Roman),1),
"__Previous",[Value] - 1,
"__Next",[Value] + 1,
"__Roman",MID(__Roman,[Value],1)
),
"__Arabic",MAXX(FILTER(__Convert,[Roman] = [__Roman]),[Arabic])
)
VAR __Table1 =
ADDCOLUMNS(
ADDCOLUMNS(
ADDCOLUMNS(
__Table,
"__PreviousRoman",MAXX(FILTER(__Table,[Value] = EARLIER([__Previous])),[__Roman]),
"__NextRoman",MAXX(FILTER(__Table,[Value] = EARLIER([__Next])),[__Roman])
),
"__PreviousArabic",MAXX(FILTER(__Convert,[Roman] = [__PreviousRoman]),[Arabic]),
"__NextArabic",MAXX(FILTER(__Convert,[Roman] = [__NextRoman]),[Arabic])
),
"__Final",
SWITCH(TRUE(),
[__NextArabic] > [__Arabic],0,
[__PreviousArabic]<[__Arabic],[__Arabic]-[__PreviousArabic],
[__Arabic]
)
)
RETURN
SUMX(__Table1,[__Final])
eyJrIjoiOTU5NWZmODgtYmM2YS00OWQxLTgyNTEtM2IxZDRlODhiNjllIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9