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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Can you change data format in direct query?

i am tyring to change the data format in direct query but unable to do so how do i go about changing something to a text data format without being able to create calculated columns or use the data format part?

16 REPLIES 16
amitchandak
Super User
Super User

@Anonymous , I was able to change the data type from number to text.

refer : https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-1-Time-Intelligence-in/ba-p/922885

I changed the data type of year

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak & @Greg_Deckler  i do not have an opption to change the data type or format. Its not something i can edit it is currently set to teext for the field that is not working please see example below;MicrosoftTeams-image (2).png

Also, you may be able to change the data type in the Query Editor for DirectQuery. You can't in Desktop when not in the Query Editor but you may be able to change the data type while in the Query Editor. But still weird that you are getting that error with COUNT.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler no can't use the query editor doesnt give me the option as is analysis data. I tried the COUNTX but get the same error not sure where to go with this now

Also, if you really think it is a bug, what version of Desktop are you using? You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.

If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

You don't have any other column that you can try counting? What about instead of COUNTX, just use COUNTROWS in my formula I posted?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

COUNTROWS((FILTER(ALLEXCEPT(table1,table1[country),table1[SalesUnits]>0))



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler  but i may have solved this it seems it could be down to the relationships in the tabular model as have managed to get the COUNTA to work when using 1 table but when looking at multiple it breaks again

 

Still weird! 🙂


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Also, this is very odd, COUNT specifically says it supports Strings.

https://docs.microsoft.com/en-us/dax/count-function-dax



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler yeah that is what i am really struggling with as it says it should work with it

Greg_Deckler
Community Champion
Community Champion

No, love the user name.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler thank you so how would i fix the following calculation;

 

CALCULATE(COUNT(Product[Name]),FILTER(table1,table1[SalesUnits]>0),ALLEXCEPT(table1,table1[country]))
 Capture.JPG
as currently it is saying i am unable to do this;
 
 

I think COUNTA ?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler have tried counta but that doesnt work either as when i put into a table the total of the table is not correct it comes out about 2000 when should be about 100,000

Maybe try a different way of doing that Measure:

 

CALCULATE(COUNT(Product[Name]),FILTER(table1,table1[SalesUnits]>0),ALLEXCEPT(table1,table1[country]))

 

instead try:

 

COUNTX(FILTER(ALLEXCEPT(table1,table1[country),table1[SalesUnits]>0),Product[Name])



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors