Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Harish85
Helper I
Helper I

sap bo to powerbi

I want to create variable in Powerbi, below is the sap bo formula.

Please help me.

 

 

Fisical_year_filter= CASE WHEN (substr(current_date,6,2))  IN ( '01','02','03') THEN (substr(current_date,1,4)-1) ELSE (substr(current_date,1,4)) END

1 ACCEPTED SOLUTION
v-mengmli-msft
Community Support
Community Support

Hi @Harish85 ,

 

What is the result of your current formula? Also, what are your expected results? I was hoping you could provide an example.

In general, in DAX we use the If as the judgment statement and the MID to extract the substring. You can try below formula firstly.

Measure = IF(MID(MAX('Table'[DATE]),6,2) IN {"01","02","03"}, MID(MAX('Table'[DATE]),1,4)-1,MID(MAX('Table'[DATE]),1,4))

 

 

Best regards,

Mengmeng Li

View solution in original post

4 REPLIES 4
v-mengmli-msft
Community Support
Community Support

Hi @Harish85 ,

 

What is the result of your current formula? Also, what are your expected results? I was hoping you could provide an example.

In general, in DAX we use the If as the judgment statement and the MID to extract the substring. You can try below formula firstly.

Measure = IF(MID(MAX('Table'[DATE]),6,2) IN {"01","02","03"}, MID(MAX('Table'[DATE]),1,4)-1,MID(MAX('Table'[DATE]),1,4))

 

 

Best regards,

Mengmeng Li

ThomasWeppler
Impactful Individual
Impactful Individual

I you want to write that in Dax try something like this 
Fisical_year_filter= if(substr(current_date,6,2) in {01,02,03}, date(year(today),month(1), day(1))-1, date(year(today),month(1), day(1))

I am not sure I got everything right, but a good place to start would be to look of power BI

If function

In function
datediff function.

 

I think that would get you in the direction of a good solution.

when I am trying to create above given formula substring is not coming up, can you help me in that.

Harish85_0-1729858741732.png

 

Is sustring a value in a table? If so:
First write selectedvalue( and then write substring.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.