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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
asdf1608
Helper V
Helper V

If condition and parameter in power bI

I am converting the tableau calculated field to power BI.

Need to create a paramter like this in power BI

asdf1608_0-1678373301284.png

Then using that parameter to create a calculated field in power BI

 

IF [Last X Days] = 'Last 2 Days'
THEN [Date] >= TODAY() - 2
AND [Date]<= [End Date]

ELSEIF [Last X Days] = 'Last 4 Days'
THEN [Date]>=TODAY() - 4
AND [ Date]<= [End Date]

ELSEIF [Last X Days] = 'Last 7 Days'
THEN [ Date]>=TODAY() - 7
AND [ Date]<= [End Date]

ELSEIF [Last X Days] = 'Last 30 Days'
THEN [Date]>=TODAY() - 30
AND [ Date]<= [End Date]

END

Help in this is neede and urgent. 
Thanks in advance

1 REPLY 1
amitchandak
Super User
Super User

@asdf1608 , In power bi we create an independent table and use those values to create a measure

 

example

https://medium.com/chandakamit/power-bi-when-i-felt-lazy-and-i-needed-too-many-measures-ed8de20d9f79

 

Measure Slicer: https://www.youtube.com/watch?v=JLkKTJrdv04&list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54&index=19

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.