Forum Discussion
DATATABLE code help
Sorry I wasn't very clear, Nathaniel_C ! I need a table with multiple "Gift Level" values for my "Bigger" value in the "Level Name" column.
Thanks for taking a look at this; I appreciate your time.
Hi MarkPalmberg ,
I guess I still don't understand. Could you dummy up a picture of your expected outlook?
Thanks,
Nathaniel
- MarkPalmberg6 years agoKudo Commander
Reading your last reply turned on a lightbulb for me, Nathaniel_C . *My* issue was that I was trying to shoehorn an Excel format into a Power BI table; see below. The answer simply seems to be (duh) to create multiple instances of my Bigger row:
Gift Table = DATATABLE ( "Gift Level Name", STRING, "Gift Level", STRING, "Gifts Needed", INTEGER, "Prospects Needed", INTEGER, "Dollars Needed", CURRENCY, "Cumulative Total", CURRENCY, { { "Biggest", "#####1", #####, #####, #####, #####}, { "Bigger", "#####1", #####, #####, #####, ##### }, { "Bigger", "#####2", #####, #####, #####, ##### }, { "Bigger", "#####3", #####, #####, #####, ##### }, { "Big", "#####1", #####, #####, #####, #####}, { "Big", "#####2", #####, #####, #####, #####}, { "Big", "#####3", #####, #####, #####, #####} } )- Nathaniel_C6 years agoCommunity Champion
Wow! Does it work? Usually I might just have the first column on multiple rows.
Nathaniel
- MarkPalmberg6 years agoKudo Commander
Yes, "first column in multiple rows" is how it's going to have to work in Power BI, I think, Which is probably fine, maybe in a Matrix visualization? Now the trick will be if I can populate my numeric values with VARs when I create the table. I was thinking I read somewhere that I can. Like:
Gift Table = VAR BIGGER1 = CALCULATE( SUM(SOMECOLUMN), SOMEFILTER) RETURN DATATABLE ( "Gift Level Name", STRING, "Gift Level", STRING, "Gifts Needed", INTEGER, "Prospects Needed", INTEGER, "Dollars Needed", CURRENCY, "Cumulative Total", CURRENCY, { { "Biggest", "#####1", #####, #####, #####, #####}, { "Bigger", BIGGER1, #####, #####, #####, ##### }, { "Bigger", "#####2", #####, #####, #####, ##### }, { "Bigger", "#####3", #####, #####, #####, ##### }, { "Big", "#####1", #####, #####, #####, #####}, { "Big", "#####2", #####, #####, #####, #####}, { "Big", "#####3", #####, #####, #####, #####} } )Thanks for your replies, Nathaniel_C !