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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
matthias_vc
Frequent Visitor

Dataviewmapping group by date/hierarchical grouping

Hi, 

 

because it's not possible to have dates in the vertical axis of a line graph (e.g. to make a Milestone trend analysis) https://community.powerbi.com/t5/Desktop/Create-Milestone-Trend-Analysis-MTA-in-Power-BI/td-p/191509 I've decided to try and make my own visual that allows it.

 

I've used following mapping:

 

 

{
    "dataRoles": [
        {
            "displayName": "Data Date",
            "name": "dataDate",
            "kind": "Grouping"
        },
        {
            "displayName": "Values",
            "name": "measure",
            "kind": "Measure"
        },
        {
            "displayName": "Grouping With",
            "name": "grouping",
            "kind": "Grouping"
        }
    ],
"dataViewMappings": [
        { 
            "categorical": {
                "categories": {
                    "for": {
                        "in": "grouping" }
                },
                "values": {
                    "group": {
                        "by": "dataDate",
                        "select": [{
                                "for": {
                                    "in": "measure"
                                }
                            }
                        ]
                    }
                }
            }
        }
    ]
}

 

 

And this gives me some results:

 

"tree": undefined
"categorical":  {
  "categories":  [
     {
         "source": {...}
         "values": [
            "Milestone 1",
            "Milestone 2",
            "Milestone 3"
         ],
         "identity": [...]
         "identityFields": [...]
     }
  ],
  "values":  [
     {
         "source": {...}
         "values": [
            {Values associated with Milestone 1+datadate1},
            {Values associated with Milestone 2+datadate1},
            {Values associated with Milestone 3+datadate1}
         ],
         "identity": [...]
     },
     {
         "source": {...}
         "values": [
            {Values associated with Milestone 1+datadate2},
            {Values associated with Milestone 2+datadate2},
            {Values associated with Milestone 3+datadate2}
         ],
         "identity": [...]
     },
     ... (values for datadate 3,4,5)
  ]
},
"table": undefined,
"matrix": undefined,
"single": undefined,
"metadata": {...}

 

 So I can find the categories and their names, I can find the values and the dates? But I can not find the Data Dates I'm grouping by. Where should I find them?

1 REPLY 1
matthias_vc
Frequent Visitor

Sorry, I've managed to fix this issue in the meantime.
By using a condition of max 1 on the Data Date, dragging it to the selection field will select it as a field instead of as a combination of Year+Quarter+month+Date making it also readible in the variable object (under Values[i].source.groupName)

 

kind regards, 

Matthias

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.