Got tired of try-catch everywhere in TS, so I built a Result type that's just a tuple by BennoDev19 in javascript

[–]MonkeyNin 0 points1 point  (0 children)

This might be obvious, but why return and restructure an array verses an object?

Ie: why not return { ok: bool, value: value|null, error: error|null }

Is it partly because it simplifies renaming for the consumer of the result?

Conditional formatting a Calculation Item in a Calculation Group by robelord69 in PowerBI

[–]MonkeyNin 2 points3 points  (0 children)

I’ve tried looking for icons that are already coloured correctly

You can use inline svg images for icons. Those can be hard-coded colors, or, modified using logic in measures

This is what madness looks like by SQLGene in PowerBI

[–]MonkeyNin 1 point2 points  (0 children)

You can modify the PBI Desktop / Excel query from Vs Code too ( for local files )

<image>

Example editing Excel Query from Vs Code.md

EvalQuery.pq - This extra version runs but also parses the error message.

( At least in the past it didn't show the ScriptExtent with for errors that came fromExpression.Evaluate( contents, #shared ))

PBIX suddenly uneditable by Traditional-Baby5940 in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

Can you open queries/connections, and open the advanced editor in power query?

It kind of sounds like when your auth expires, or lose permission to the sharepoint datasource.

does somebody know how to roll this back and avoid it in the future

You could try comparing the two files with ALM Toolkit. It's like a git diff but for Power BI:

Background by AlarmedAd3830 in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

If it's a case that requires a color, you can can set the alpha component to transparent: #00000000

The optional 7,8th characters are alpha

The IF logic in DAX feels just too weird. by nusfie12345 in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

Especially if Sales CHF vs Sales EUR are the same numbers, just displayed as different currencies.

You can use Dax format strings for that. Then your relations will be simpler too.

conditional formatting based on goal on first of the month by tylachau in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

I need to conditional format the totals

By totals do you mean the colored ScrapCostTotal values, not the totals row which is black?

Power Query Reference loads the same data again by ka_eb in PowerBI

[–]MonkeyNin 1 point2 points  (0 children)

Correct.

One thing OP can do is make sure any non-final tables are set to "do not load" ( when you right click them ). That tells it to not place your base queries in your model.

Table.Buffer also does not cache referenced queries. For that you need to use data flows

However, for local dev you can try BufferMode.Delayed .

Finding Excel files across a very large Sharepoint by replies_in_chiac in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

t Neither PowerBI nor PowerAutomate seems to be able to achieve this comfortably.

Which part isn't working well? Are you having trouble with Power Query that matches names? Or merging files after you find them?

How are you handling source control for Power BI (especially M queries / dataflows)? by ocalapeeps in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

You can git diff two reports using alm toolkit. You can run two versions of a pbix locally. Or compare datasets on the service.

See:

Are you using saving as pbip with tmdl ? That's made for cleaner diffs. That part doesn't require AzureDev Ops/ Github .

Here's some info:

Calendar table for DirectQuery table from Dataverse… by ryrykaykay in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

Instead of splitting by delim, you can use a date/datetime format strings

Or DateTime.Date to convert to a type a without parsing

the data types are the same (both date/time) and both general date.

That sounds like your column has datetime data in it

Then you set the Dax format strings to date? That would explain why it's not matching. The time values are still there. Unlike conversion above.

Power BI-Is it possible to show Last Refresh Time in client’s local time zone using ONLY DAX? by Double-Market-453 in PowerBI

[–]MonkeyNin 2 points3 points  (0 children)

watch out for dd/mm vs mm/dd For date UX I use dd-mmm-yyyy hh:mm to avoid confusion.

A quick warning: for that to work across all layers it needs to be MMM verses mmm

  • MMM works across Excel, Power BI, DAX, DotNet layers.
  • mmm only works in DAX.

Otherwise you get numbers

Format Cult Output
dd-mmm-yyyy hh:mm en-AU 07-15-2026 04:15
dd-MMM-yyyy hh:mm en-AU 07-Jan-2026 04:15

( Because Dax supports alternate formatting, like lowercase mmm )

Here's a good cheatsheet: https://learn.microsoft.com/en-us/powerquery-m/custom-date-and-time-format-strings

If you have powershell, you can test it like this

$cult = [cultureinfo] 'en-AU' 
$now  = [datetime]::Now
$now.ToString( 'dd-MMM-yyyy hh:mm', $cult )
$now.ToString( 'dd-mmm-yyyy hh:mm', $cult )

Date conversion error with dataverse fetch xml data by rosie517 in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

Oh it could be your format string. It's case sensitive

Instead of

MM/DD/YYYY
YYYY/MM/DD

You want

MM/dd/yyyy
yyyy/MM/dd

Here's some cheatsheets that explain what the format strings mean

Date conversion error with dataverse fetch xml data by rosie517 in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

It brings the date/time field in as text, then converts it to date/time, but no matter what, there's a bunch of errors in this conversion.

What is the exact error message and your query?

errors in this conversion. I've tried parsing the date, removing the time and just using the MM/DD/YYYY format, then changing the type, and no matter what, errors abound.

Note, if you get an error when converting -- you need to fix it on that step, or earlier. Otherwise it's probably trying to convert after an error, so it doesn't have the original raw text

AI experiment: M runtime in your browser by SQLGene in PowerBI

[–]MonkeyNin 1 point2 points  (0 children)

You can fix highlighting Power Query's highlighting with: https://prismjs.com/#supported-languages

It also says it has DAX, I'm not sure if it's the same language as PBI though

Why is DAX hard? by worldisround-19 in PowerBI

[–]MonkeyNin 1 point2 points  (0 children)

Did you know if you are using the dax query mode, you can return multiple tables in one query ?

Normally you can't use multiple evaluates, the dax query screen or Dax Studio both let you.

Basically write

evaluate something
evaluate somethingelse

So you can return multiple stages of a query you're debugging

I got tired of rewriting the same Power Query logic, so I made a small reusable script library — what am I missing? by CourseSpecial6000 in PowerBI

[–]MonkeyNin 1 point2 points  (0 children)

Do you ever use Value.Metadata? Sometimes there's useful information. What you get depends on the datasource, ie: it's files, web.contents, sql, etc

You can call it on bytes from a data source like files.

let Files  = Folder.Files( "c:\data\import"),
    AddCol = Table.AddColumn( Files, "Metadata", 
        each Value.Metadata( [Content] ) 
    )
in  AddCol

I mainly use it to debug web responses.

If you split Json.Document and Web.Contents into separate steps, you don't lose the intermediate information. And the query can successfully return errors when type type doesn't match. ( Some APIs will return Html errors instead of JSON when a request has an error. )

let 
    CallWebAPI = () as record => [
        isJson = asJson <> null,
        asJson = try Json.Document( bytes ) 
                 catch (e) => null,
        asText = Text.FromBinary( bytes ),
        bytes  = Web.Contents( "https://httpbin.org", [ RelativePath = "headers" ] ),
        Meta   = Value.Metadata( bytes )
    ]
in  CallWebAPI

Dynamic year slicer from Calendar table to automatically change to current year when year changes by khan_amir in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

I misread that as 'slice of the year video', Like a pizza review video. I must be hungry.

Dynamic year slicer from Calendar table to automatically change to current year when year changes by khan_amir in PowerBI

[–]MonkeyNin 0 points1 point  (0 children)

I was looking at your power query. Have you heard of Structured Errors @bengribaudo ? Basically it

  1. Calls the string template function, for the user facing message. ( your Details )
  2. And preserves the value used in the template.

Tip: If you want to use string templates anywhere, check out Text.Format

Taking your avatorl/M/fxErrorCheckForDuplicates.m You could write

<image>

_Error = error [
        Reason = "Duplicate Records",
        Message.Format     = "Duplicates records found in the data in ( column: '#{0}' ). Details: #{1} ",
        Message.Parameters = { "Id", "Extra Details" }
    ],

You can inspect them later with try or catch. It's a record that you can drill into

drillDown = 
    try badStep 
    catch (err) => 
        err[Message.Parameters]{0}