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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sunilbhanushali
New Member

calculate Minimum value based on Filter Selection

I want to find minimum value and put it in seperate column to show and this minimum value would change based on the selection done.

 

Scenario 1

 

sunilbhanushali_1-1631791376847.png

 

 

When there is no seletion on Qtr value or when all Qtrs are selected, Q1 has minimum value hence last column is showing minimum value 100

 

Scenario 2

 

But now user can change filter condition on Qtr and can select Q2,Q3 and Q4 and hence minimum value will change now to that of Q2 which is 200

 

sunilbhanushali_2-1631791479515.png

 

I am using Direct query mode to fetch the results.  Year and Amt are coming from two different tables.

 

I am trying to write DAX by creating measure for e.g. 

 

min_amt = CALCULATE(min(amt),ALLEXCEPT(table,table[Qtr])

 

but still no luck as it is still showing 100 even when I am not selecting Q1 as part of my filter condition.

4 REPLIES 4
v-yetao1-msft
Community Support
Community Support

Hi @sunilbhanushali 

Please try a measure like this :

 

Min Amt = CALCULATE(MIN('Table'[Amt]),ALLSELECTED('Table'))

 

And the final result is as shown :

Ailsamsft_0-1632881781368.pngAilsamsft_1-1632881781369.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

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

mh2587
Super User
Super User

Please share sample data I will try on it 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



mh2587
Super User
Super User

min_amt = CALCULATE(min(amt),ALLSELECTED(table,table[Qtr])

Just change allexcept with allselected hope it will work


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hi,

 

i had tried ALLSELECTED too but it didn't work. I also tried using summerize funcatin with no luck

 

v_min_amt = 
var grpby = SUMMARIZE(
            table,
            table[Qtr]
            )
return minx(grpby,min(table[amt]))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.