Print Document

PowerBi Reference Document
Version 01
Release Date 01 Jan 2021
Type SAP Documents
Status Released

Add Serial No / Index column to Model

1. Click on Transform Data

 

2. Select Index column on AddColumn Tab to generate Index.

 

Measure : Count Distinct with Filter

 

How to Concatenate Date and Time field to One field using transform function

1. Transform --> Change Date Column to Date Type

 

2. Transform : Convert the Date column back to text column. (Note : This transformation should be inserted as a new step)

 

4. Transform : Convert Time column to Type Time 

5. Transform : Convert Time Column form Type Time to Text.

The ultimate aim to have a text column of Date and Time properly converted.

6. Create a new Column and use the following to Concatenate Date and TimeField

.

 

7. Convert the new column to Date/Time Type.

 

Alternatively , point 6 -7 can be achieved using standard  date parsing functionality. Select the Date and Time column and use Combine Date/Time option.

 

IF ELSE condition in DAX.

In standard Power Bi / Power Query there is an option for creating conditions column without the need to add any code. But the limitation is AND / OR conditions cannot be added. For such requirements the statement in entered manually.

 

 

Sample Code

 Calculate Cumulative total field with filters

Cumulative totals will work only with measures , if filter parameters are provided.

zcum_tot2_meas = VAR zdate = maxx(stock,stock[loaddate]) return CALCULATE(sumx(FILTER(stock,stock[Symbol]=SELECTEDVALUE(stock[Symbol])),stock[LTP]),REMOVEFILTERS(stock[loaddate]),stock[loaddate]<=zdate)

zcum_tot2_meas = VAR zdate = maxx(stock,stock[loaddate]) return CALCULATE(sumx(stock,stock[LTP]),REMOVEFILTERS(stock[loaddate]),stock[loaddate]<=zdate)

 

Note : Calculate will first evaluate the filters and then perform sumx operation.

 


Table of contents

Technical Documents
Configuration Guide
External Reference
SAP Note
SDN Links
Messages
Sample Code