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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
gurunath_1986
New Member

Help Needed to find DAX formula

Hi, 

   I have Indian election poll data over year as attached screenshot I want to create DAX function to find winning candidate name from dataset for specific state,year and for specific PC No. 

 

Kindly help me out.

 

gurunath_1986_1-1708430868805.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gurunath_1986 ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_0-1708494440011.png

2.Create the new measure.

 

Winning Candidate = 
VAR MaxVotes = CALCULATE(MAX(ElectionTable[totvotpoll]), ALLEXCEPT('ElectionTable', 'ElectionTable'[state], 'ElectionTable'[year], 'ElectionTable'[pc-number]))
RETURN
CALCULATE(
    MAXX(FILTER('ElectionTable', 'ElectionTable'[totvotpoll] = MaxVotes), 'ElectionTable'[candidate-name]), 
    ALLEXCEPT('ElectionTable', 'ElectionTable'[state], 'ElectionTable'[year], 'ElectionTable'[pc-number])
)

 

3.Drag the measure into the table visual. The result is shown below.

vjiewumsft_2-1708494552007.png

Best Regards,

Wisdom Wu

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

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @gurunath_1986 ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_0-1708494440011.png

2.Create the new measure.

 

Winning Candidate = 
VAR MaxVotes = CALCULATE(MAX(ElectionTable[totvotpoll]), ALLEXCEPT('ElectionTable', 'ElectionTable'[state], 'ElectionTable'[year], 'ElectionTable'[pc-number]))
RETURN
CALCULATE(
    MAXX(FILTER('ElectionTable', 'ElectionTable'[totvotpoll] = MaxVotes), 'ElectionTable'[candidate-name]), 
    ALLEXCEPT('ElectionTable', 'ElectionTable'[state], 'ElectionTable'[year], 'ElectionTable'[pc-number])
)

 

3.Drag the measure into the table visual. The result is shown below.

vjiewumsft_2-1708494552007.png

Best Regards,

Wisdom Wu

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

 

 

 

lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.