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 September 15. Request your voucher.

Reply
FZOU
Helper IV
Helper IV

Help with DAX

Hello,

I want to do a dax formula but i didn't figure out how to do it,EXP :

 

I have this table which contain : Product,Month,Percent(percent discount per month),AppliedYear(the year to apply the percent,0=CurrentYear(2020);1=2021;2=2022.....

Tab.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I added a whatifparam which contain values from 1 to 30 for the choosen Appliedyear by user(if there is any other better solution i'll take it)

 

the need is : if Product is not empty then we display the product with applied year = paramAppliedyear(choosen by user) if we haven't an appliedyear so we take the first smallest applied else we take the first greatest appliedyear.

to be clear : paramAppliedYear=1;if product not empty we display product with appliedyear =1 else product with appliedyear=0 else Productyear with appliedyear=2..

The PBIX file link on drive : https://drive.google.com/open?id=1J4xlclwiGPX8876UG8iuguAQAfG7BZQW
Thank you 🙂

Spoiler
Spoiler
 

 

Spoiler
 

 

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @FZOU ,

 

Is this logic?

When paramAppliedYear = x 
    if products <> blank()
    display products  where appliedyear =x
    else
    display products where appliedyear=x-1 && appliedyear = x+1

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lionel-msft, it's the demand like that,is this not logic !?

parry2k
Super User
Super User

@FZOU what you mean by product not empty? It is not very clear what refers to product  empty or not empty?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2kthank you for your reply,empty it's mean sometimes we don't have a product but we have the months,percent,appliedyear.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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