1
$\begingroup$

Consider the following Dataset.

cities={"city1","city2","city3","city4"};
metrics={"Food revenue","Drinks revenue","Food costs","Drink costs","Staff costs","Overhead costs"};
entries={
    {266667,266667,91667,130000},
    {450000,213333,273333,241667},
    {-165000,-200000,-75000,-90750},
    {-108000,-80000,-45000,-37500},
    {-206250,-115500,-127125,-128625},
    {-120000,-78000,-90000,-64500}
};
data=AssociationThread[metrics->(AssociationThread[cities->#]&/@entries)];
dataset=Dataset@data

Currently it displays properly but as soon as I add more depth as follows:

ClearAll[deeper];
deeper[assoc_Association,func_Function:(#1-><|""->#2|>&)]:=Association@KeyValueMap[func,assoc];

rent=AssociationThread[cities->{-56000,-36000,-42000,-32000}];
dataset[<|
    "Food revenue"->deeper[#"Food revenue"],
    "Drinks revenue"->deeper[#"Drinks revenue"],
    "Food costs"->deeper[#"Food costs"],
    "Drink costs"->deeper[#"Drink costs"],
    "Staff costs"->deeper[#"Staff costs",#1-><|"Managerial salary"->-42000,"Other salaries"->(#2+42000),""->#2|>&],
    "Overhead costs"->deeper[#"Overhead costs",#1-><|"Head office cost"->-60000/4,"Rental charges"->rent[#1],"Other overheads"->(#2+60000/4-rent[#1]),""->#2|>&]
|>&,<|
    #
|>&][<|
    #,
    "Profit/(loss)"->Query[Total,All,{""}]@#
|>&,<|
    #,
    "Total"->Query[Total,All]@#
|>&]

It start hiding the deeper / inner records. How to make it display the Dataset in its entirety? Note: I already tried increasing the Dataset`$ElisionThreshold to no success.

Also if someone can suggest better / compact way to perform the calculations I am doing here, that would be helpful.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.