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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Need help with the measure

I am having the below measure and now wanted to modify it to include the logic

 

if the date is less than or equal to 30 June 2022  

 

Sumx(Values(Invoices[AgentNumber]),
CALCULATE(IF([Amount]<7000,0,
IF([Amount]>100001,5000,([Amount]*.05)))))
1 ACCEPTED SOLUTION

@gauravnarchal , measure when

If gross is a column

Sumx(Table,Switch( True() ,
[Invoice date] <= date(2022,06,30),
Switch( True(),
[Gross Amount] < 7000,0,
[Gross Amount]>45000,5000,
[Gross Amount]*.03) ,
[Invoice date] >= date(2022,07,01),
Switch( True(),
[Gross Amount]>4500,[Gross Amount] * 0.03,
[Gross Amount]<=65000,[Gross Amount]*.04,
[Gross Amount]>65001,[Gross Amount]*.05)) )


if gross is a measure

Switch( True() ,
max([Invoice date]) <= date(2022,06,30),
Switch( True(),
[Gross Amount] < 7000,0,
[Gross Amount]>45000,5000,
[Gross Amount]*.03) ,
max([Invoice date]) >= date(2022,07,01),
Switch( True(),
[Gross Amount]>4500,[Gross Amount] * 0.03,
[Gross Amount]<=65000,[Gross Amount]*.04,
[Gross Amount]>65001,[Gross Amount]*.05))

 

yet to check the file

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@gauravnarchal , try like

 

calculate(
Sumx(Values(Invoices[AgentNumber]),
CALCULATE(IF([Amount]<7000,0,
IF([Amount]>100001,5000,([Amount]*.05))))), filter(Table,Table[Date] <= date(2022,06,30)))

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  - i tried the logic that you have provided but it is not returning the desired result.

 

I have attach the PBIX file for your reference. Click Here 

 

Thank you for your help.

 

Condition

 

First

Invoice date is less than equal to 30 June 2022

IF([Gross Amount]<7000,0,

IF([Gross Amount]>45000,5000,([Gross Amount]*.03

 

Second

Invoice date is greater than equal to 01 July 2022

IF([Gross Amount]<=4500,[Gross Amount] * 0.03,

IF([Gross Amount]<=65000,[Gross Amount]*.04,

IF([Gross Amount]>65001,[Gross Amount]*.05

@gauravnarchal , measure when

If gross is a column

Sumx(Table,Switch( True() ,
[Invoice date] <= date(2022,06,30),
Switch( True(),
[Gross Amount] < 7000,0,
[Gross Amount]>45000,5000,
[Gross Amount]*.03) ,
[Invoice date] >= date(2022,07,01),
Switch( True(),
[Gross Amount]>4500,[Gross Amount] * 0.03,
[Gross Amount]<=65000,[Gross Amount]*.04,
[Gross Amount]>65001,[Gross Amount]*.05)) )


if gross is a measure

Switch( True() ,
max([Invoice date]) <= date(2022,06,30),
Switch( True(),
[Gross Amount] < 7000,0,
[Gross Amount]>45000,5000,
[Gross Amount]*.03) ,
max([Invoice date]) >= date(2022,07,01),
Switch( True(),
[Gross Amount]>4500,[Gross Amount] * 0.03,
[Gross Amount]<=65000,[Gross Amount]*.04,
[Gross Amount]>65001,[Gross Amount]*.05))

 

yet to check the file

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.