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

Trimming text or date in time: Powershell API dataset

Using PowerBI for the first time...

 

I am using a Powershell script to retrieve date & time, text, and numerical values. For reporting I wanted to remove the time from the date and time value. Which I thought I had completed in the powershell script, but a default time of 0:00 or 12:00am gets added back to the values once in Powerbi. Additionally to clean up the presentation I want to remove 'https://www' from the URLs. 

 

powershell date value  = Get-Date -DisplayHint Date -Format MM/dd/yyyy

 

The above is working as expected when we run the script in powershell, but as I said a default value is added once it loads on desktop and report views for PowerBI.

 

test_urlpagespeed_scorepage_bytesreport_date
https://www.testurls.listedhere.com809322293/1/2020 0:00
https://www.testurls.listedhere.com7912302343/1/2020 0:00

 

My question is can you point me to past conversations that may help me fix the formating. It looks like I am unable to use Modeling features due to pulling data from an API vs database. I want to remove characters from the start of URLS, and split date and time using Measures, so far with no luck.

 

I appriciate your feedback.

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @adam12asu 

 

Based on your description, I created data to reproduce your scenario.

Table:

f1.png

 

You may create two measures as follows.

testurlMeasure = 
var x = MAX('Table'[test_url])
return
IF(
    LEFT(x,11) = "https://www",
    RIGHT(x,LEN(x)-LEN(LEFT(x,11)))
)

reportdateMeasure = 
var _currentdate = MAX('Table'[report_date])
return
MONTH(_currentdate)&"/"&DAY(_currentdate)&"/"&YEAR(_currentdate)

 

Result:

f2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @adam12asu 

 

Based on your description, I created data to reproduce your scenario.

Table:

f1.png

 

You may create two measures as follows.

testurlMeasure = 
var x = MAX('Table'[test_url])
return
IF(
    LEFT(x,11) = "https://www",
    RIGHT(x,LEN(x)-LEN(LEFT(x,11)))
)

reportdateMeasure = 
var _currentdate = MAX('Table'[report_date])
return
MONTH(_currentdate)&"/"&DAY(_currentdate)&"/"&YEAR(_currentdate)

 

Result:

f2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-alq-msft  Thank you that has saved me and imense amount of time and has formatted both data fields.

amitchandak
Super User
Super User

In Datatype choose Date and in Format choose the required format

Data Format.png

 

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, but I am unable to select any of the Modeling values.

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