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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
psyang
Frequent Visitor

Date Fields - Don't want to default to Hierarchy

I have a custom visual that takes a datetime field. However, the visual requires the field to be entered as a straight date, not a date hierarchy.

 

I was hoping there would be something I could put in the capabilities.json file to:

1) Ensure the field entered is a datetime field

2) Ensure the datetime does not come in as a date hierarchy.

 

However, I don't see anything in requiredTypes or preferredTypes for datetime fields. Am I out of luck?

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

The first issue can be easily resolved in TypeScript code by checking type of column:

 

if (dataView.metadata.columns[dateColumnIndex].type.dateTime) {
    // TODO: Put some code here
}

 

 

The second issue with date hierarchy can be resolved by adding a condition into capabilities.json:

 

            "conditions": [
                {
                    "Time": {
                        "max": 1
                    }
                }
            ],

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

2 REPLIES 2
v-viig
Community Champion
Community Champion

The first issue can be easily resolved in TypeScript code by checking type of column:

 

if (dataView.metadata.columns[dateColumnIndex].type.dateTime) {
    // TODO: Put some code here
}

 

 

The second issue with date hierarchy can be resolved by adding a condition into capabilities.json:

 

            "conditions": [
                {
                    "Time": {
                        "max": 1
                    }
                }
            ],

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

psyang
Frequent Visitor

Thanks for the quick response.

 

#1 isn't ideal, but maybe that's the best solution. It seems strange that we can restrict fields to numbers, strings, or booleans, but not dates. Hopefully this gets added to the available preferred/requiredTypes enumeration.

 

#2 works great!

 

Thanks again!

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.