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
MrDannyHarry
Regular Visitor

Postgres Folding issue

Hi All,

 

I am connecting to a Postgres Database using Direct Query.

 

When ever I try to do a visual on a calculated field or measure I get the following error:

We couldn't fold the expression to the data source. Please try a simpler expression.

 

I can do it on a non calculated field but not on calculated.

 

My measure has the following code in it.

(This converts seconds  to show 00 hours 00 minutes 00 seconds)

TotalTalk Time = var total = sum(mb_callstats[call_servicing_sec]) var hours = int(total/3600) var minutes = int(mod(total, 3600)/60) var seconds = mod(mod(total, 3600),60) return hours & " hours " & minutes & " minutes " & seconds & " seconds" 

 

Which pulls from a calculated column with the following code in it:
(This converts time format 00:00:00 to seconds)

call_servicing_sec = SECOND(mb_callstats[call_servicing]) + MINUTE(mb_callstats[call_servicing]) * 60 + HOUR(mb_callstats[call_servicing]) * 3600

 

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi @MrDannyHarry 

Similar issue has been reported: CRI 189036561. 

if you could try while transforming data- https://community.powerbi.com/t5/Desktop/Calculate-difference-between-two-dates-power-query/m-p/6236...

like using each Duration.Days([Date1] - [Date2])

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@MrDannyHarry , refer the problem test given in -https://community.powerbi.com/t5/Desktop/Postgres-EnableFolding/m-p/839734

 

If setting can help

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

@amitchandak 

 

Thanks for your prompt reply.

 

My current query is a s follows:

 

let
    Source = PostgreSQL.Database("IP_ADDRESS", "DB_NAME", [CreateNavigationProperties=false]),
    public_mb_callstats = Source{[Schema="public",Item="mb_callstats"]}[Data]
in
    public_mb_callstats

 

 

What would need to change?

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.

Top Solution Authors
Top Kudoed Authors