Thursday, January 26, 2023

Pass multiple values to parameters in DAX from paginated report

 Hi, 

Have u encountered how to pass multiple values in DAX filter from paginated report?

If yes, then follow the steps for implementation :)

First set parameter is set to accept multiple values from user.













Then in Dataset properties in Parameters tab, set the value of the parameter with following:

=Join(Parameters!myParameter.Value, "|")






Then inside you Query Designer, this is how you will define the filter

VAR __DS0FilterTable =  FILTER(

KEEPFILTERS(VALUES('someTable'[someCol])),               PATHCONTAINS(@myParameter,'someTable'[someCol])

)

HTH

Saturday, July 16, 2022

Pass parameters in Powerbi Paginated reports to SQL Server

To pass parameters to SQL Server from Powerbi Paginated reports (Powerbi Report Builder), we will declare parameters with some name and then use this parameter using escape character `@` in the query builder.

Example:

















HTH

Pass parameters in Powerbi Paginated reports to Azure databricks using Simba ODBC

To pass parameters in Azure Databricks from Powerbi Paginated reports (Powerbi Report Builder), we will use ? as parameters name (yes you can define multiple parameters and all with ?) and then in same order parameters are applied to query.

Example:













HTH

Tuesday, July 5, 2022

Publish Powerbi Streaming Dataset via API

Streaming dataset can be challenging if not understand right. There are limitations when created from Powerbi workspace i.e. it will always create streaming dataset with FIFO supporting 200,000 rows.

So to enable streaming dataset to support 5 million rows, it would require API calls to create dataset.

Below example using postman posting calls.

  1. First it require Security Token to be sent as part of Post request.
  2. Then inside the Body of Post request, make the body type JSON and define your dataset (see sample dataset). 
  3. Third, we need to make sure to set defaultRetentionPolicy = None passed as request parameter. 

Here is Http post request looks like:

https://api.powerbi.com/v1.0/myorg/groups/<PUT_WORKSPACE_ID_HERE>/datasets?defaultRetentionPolicy=None

Sample dataset in the body of post request:

{
  "name": "Sample_Streaming_Dataset_5m",
  "defaultMode": "PushStreaming",
  "tables": [
    {
      "name": "RealtimeDT5m",
      "columns": [
        {
          "name": "Sales",
          "dataType": "Double"
        },
        {
          "name": "Credits",
          "dataType": "Double"
        },
        {
          "name": "StoreId",
          "dataType": "string"
        },
        {
          "name": "BusinessDay",
          "dataType": "DateTime"
        }
      ]
    }
  ]
}
Posting will create a Streaming Dataset.

HTH

Wednesday, February 2, 2022

Databricks Notebook Reference Paths

To reference a notebook from another notebook, you need to give relative path from your current notebook. 

Example: If your working notebook are structured as below:

  1. /Users/johnDoe/Processing/ProcessFile
  2. /Users/johnDoe/Processing/BinaryFiles/ProcessBinaryFiles

and folder where the referenced notebook is placed:

     /Users/johnDoe/Referenced/myReferencedNotebook

then to reference the notebook from ProcessFile notebook would be:

%run ../Referenced/myReferencedNotebook

and to reference the notebook from ProcessBinaryFiles notebook would be:

%run ../../Referenced/myReferencedNotebook

HTH

Friday, November 5, 2021

Remove seconds pyspark sql

 To remove seconds in pyspark sql in notebook:

SELECT 

        date_trunc('day', current_timestamp) as DateTimeWithZeroHoursMinutes  

        date_trunc('minute', current_timestamp) as DateTimeWithZeroSeconds,

        date_trunc('second', current_timestamp) as DateTimeWithZeroMilliseconds,

        date_format(current_timestamp, "yyyy-MM-dd HH:mm") as DateWithNoSeconds