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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.