Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hey, is there a function or a reliable way to get the type (like number, duration, currency, ...) of each metadata column in the dataview? I can see that the underlyingType and primitiveType is changing but I don't know if this is the desired way to get the type.
Regards
Lucas
Hi @lucmax,
In terms of structure, the type property is a ValueTypeDescriptor, of which only the properties text thru none are included in the interface spec. This means that the underlyingType thru categoryString properties are presumably added by the developer visual (which the API implements). As such their implementation details aren't in the source code and it's going to be hard to figure out what those mean, or rely on them consistently.
You can see that there are some overlaps also, such as numeric and integer.
In my experience, if I have a dependency on the column type, I'll typically switch on them while iterating through and manage my logic that way (e.g. dates vs. numbers for axes) when building my view model.
If you are able, it might be worth providing some details of your particular use case, as we might be able to find a way to achieve what you are ultimately setting out to do.
Regards,
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @dm-p,
thanks for the answers, I will try to provide more details of what we want to achive.
The problem with the ValueTypeDescriptor for me is, that is does not directly provide information about currency data. Also, if I provide a column with a duration type (in the powerbi data model) it does not have type.duration set to true.
In the visual the user can apply custom labels for a graph which we transform and display in a user friendly way (duration: 5d 10h 24m, or currency: 524,56€). For this transformation we need to know the type of the datafield in the power bi data model.
We need to group the types into plain text, standard numeric values, duration and currency values.
regards,
Lucas
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |