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
Cr7vc
New Member

Need help on dax query

Hi Team,

 

I have two filters one is of date (between is used to selected dates between intervals) and other one is month.

My data contains column such as category, dealer name, opening stock, closing stock,date.

For opening stock the logic is if a date is selected example 1st Aug to 6th aug then opening stock will be the last date value of previous month .this is working correctly.

Using opening stock = calculate(sum(opening stock), lastdate(previous month(date)))

However when month filter is selected and as now with the above date selection it will be show only one value i.e aug and if select all is unchecked and only aug is selected then opening stock measure goes blank

I tried modification in the logic of opening stock using 

Opening stock = if (isfiltered(month),

calculate(sum(opening stock), lastdate(previous month(date))),

calculate(sum(opening stock), lastdate(previous month(date))))

 But still the measure goes blank when only one month is selected. Please help.

 

 

1 REPLY 1
Anonymous
Not applicable

Hi @Cr7vc ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.