The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a Power Bi Report on desktop that when I press refresh it refreshes fine, but I have to do it mannualy every day. I have tried using the web app and the shedule refresh is disabled and I can`t find a workaroun so it refresches daily.
The procees to extraxt the data is to first get the token from a Basic Login (username and paswword) and the output is on json format like this:
{
"Messages": [
{
"Type": "System",
"Level": "Info",
"Message": "Success"
}
],
"Data": {
"SiteId": 1,
"CompanyId": 40,
"TenantCode": "VIV",
"Company": "Vivaaerobus",
"UserId": 10088,
"DisplayName": "vESB Middleware VIV PRD",
"UserName": null,
"Email": "xxx@vesbrim.com",
"Token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"TokenScheme": "vToken",
"DateValid": "2025-01-30T14:49:07.3656981+00:00"
From that Json output I need to extract the Token and on this adress create anothe GET API Call:
https://viv.i-soms.com/vesb/api/public/vpos/Report/monthlySalesExt/:DATE
and on the Headers include the Authorization: vToken & (token)
The Date is a parameter and should be YYYY-MM-DD
The output is a CSV Report of the oparatin of that day so I need to do this daily.
This is my power query code that works fine only on desktop side:
Function (Login2) :
() =>
let
body = [username="xxxx@vesbrim.com",password="xxxxxxx"],
Source = Web.Contents("https://viv.i-soms.com/vesb/api/ac/sec/account/login",
[
Headers=[#"Content-Type"="application/json"]
]),
// Convierte el contenido JSON de la respuesta
JsonContent = Json.Document(Source),
// Extrae el token del campo 'Token' dentro de 'Data'
Token = JsonContent[Data][Token]
in
Token
And then another function called (Monthly):
let
let
// Define the start and end dates
DateStart = Date.From(RangeStart),
DateEnd = Date.From(DateTime.FixedLocalNow()),
// Generate a list of dates between the RangeStart and RangeEnd
dateList = List.Dates(DateStart, Duration.Days(DateEnd - DateStart), #duration(1, 0, 0, 0)),
// Function to retrieve data for a single date
GetDataForDate = (Fecha as date) =>
let
searchText = Date.ToText(Fecha, "yyyy-MM-dd"),
url = "https://viv.i-soms.com/vesb/api/public/vpos/Report/monthlySalesExt/",
csvContent = Web.Contents(url, [Headers=[Authorization="vToken " & Login2()],RelativePath = searchText]),
// Convert the CSV content to a table
csvTable = Csv.Document(csvContent, [Delimiter=",", Columns=53, Encoding=1252, QuoteStyle=QuoteStyle.None]),
// Promote the first row to headers
promotedHeaders = Table.PromoteHeaders(csvTable, [PromoteAllScalars=true]),
I works fine only on desktop, I have tried a Destop Custom connector and a web one on power automate but I havent been succesfull on both tries, could any one help me I would appreciate it very much..
Solved! Go to Solution.
Looks like your base URL doesn't exist (error 404). Try with a shorter, valid version of the base URL and put the other stuff into the RelativePath.
Yes, thank you It allowed me to schedule the refresh, but when I refresh online, I get this error:
Data source error: Expression.Error: We cannot apply field access to the type Null.. Microsoft.Data.Mashup.ErrorCode = 10335. Key = FlightScheduleList. ;We cannot apply field access to the type Null.. The exception was raised by the IDbCommand interface. Table: Tabla_Pos.
Cluster URI: WABI-MEXICO-CENTRAL-A-PRIMARY-redirect.analysis.windows.net
Activity ID: 913436aa-c575-4856-b85b-f35af9c69ba7
Request ID: 4787c9eb-72a5-452e-bcb6-16a60dd59e8e
Time: 2025-01-30 01:59:52Z
Just as background, my model pulls out data from 3 API Flight_Pre, Flight_Pos, and the Monthly Sales Extract, and also some historical data on CSV on my One drive and then merges it all into one table called Agregado the size of the Report is 909,794 KB, the size could be the culprit?
Is that a Premium/Fabric workspace or a PPU/Pro workspace?
FlightScheduleList is likely empty.
I fixed the code so I don't get Null values, but now I get this error:
Data source error: {"error": {"code": "SSAS_ShortMessage_ProcessingError","pbi.error": {"code": "SSAS_ShortMessage_ProcessingError","parameters": {},"details": [],"exceptionCulprit": 1}}} Table: Agregado.
Cluster URI: WABI-MEXICO-CENTRAL-A-PRIMARY-redirect.analysis.windows.net
Activity ID: ef0d1cff-0424-437b-9c9c-d076e68480b2
Request ID: 10494a7e-7980-4add-9908-c5cfe3a4d266
Time: 2025-01-30 12:37:09Z
What's the error message when you try to refresh in the service?
On the Semantic model, I get these errors..
Scheduled refresh has been disabled.
I cant update the credentials on that data source because it comes after the retirival of the token on the first API (with Basic Login)
Looks like your base URL doesn't exist (error 404). Try with a shorter, valid version of the base URL and put the other stuff into the RelativePath.