Forum Discussion
adam12asu
6 years agoRegular 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. Whi...
- 6 years ago
Hi, adam12asu
Based on your description, I created data to reproduce your scenario.
Table:
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:
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
6 years agoCommunity Support
Hi, adam12asu
Based on your description, I created data to reproduce your scenario.
Table:
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:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
adam12asu
6 years agoRegular Visitor
v-alq-msft Thank you that has saved me and imense amount of time and has formatted both data fields.