JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivot-container"></div>

JavaScript

let day30DaysAgo = new Date();
var today = new Date();
day30DaysAgo.setDate(today.getDate() - 30);
let timestampOfDay30DaysAgo = Date.parse(day30DaysAgo);

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 430,
  toolbar: true,
  report: {
    dataSource: {
      dataSourceType: "json",
      data: getData()
    },
    slice: {
      rows: [{
        uniqueName: "category"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }, ],
      measures: [{
          "uniqueName": "Date Last 30",
          "formula": "if(max(\"order_date\") >" + timestampOfDay30DaysAgo + ", sum(\"price\"), 0)",
          "caption": "Last 30",
          "grandTotalCaption": "Total Date Last 30",
          "individual": "true"
        },
        {
          "uniqueName": "Rest",
          "formula": "if(max(\"order_date\") >" + timestampOfDay30DaysAgo + ", 0, sum(\"price\"))",
          "caption": "Rest",
          "grandTotalCaption": "Total Rest",
          "individual": "true"
        }
      ],
    }
  },
});

function getData() {
  return [{
      "category": {
        "type": "string"
      },
    	"price": {
      "type": "number"
      },
      "order_date": {
      "type": "date string"
      }
    },
    {
      "category": "accessories",
      "price": 100,
      "order_date": "2020-09-24T23:59:30"
    },
    {
      "category": "accessories",
      "price": 100,
      "order_date": "2020-09-23T23:59:30"
    },
    {
      "category": "books",
      "price": 100,
      "order_date": "2020-09-22T23:59:30"
    },
    {
      "category": "books",
      "price": 100,
      "order_date": "2020-09-21T23:59:30",
    },
    {
      "category": "health",
      "price": 100,
      "order_date": "2020-09-20T23:59:30"
    },
    {
      "category": "health",
      "price": 100,
      "order_date": "2020-09-19T23:59:30"
    },
    // not in the last 30 days:
    {
      "category":...