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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PwC_BAN
New Member

DAX filter removing based on selection from slicer


Having issue while removing the impact of the version filter into the dax.
If the row of version doesnt exist in any profit center filter then version should not filter the rows of profit center if any version is selected. 
DAX is as below

MTD Actual Balance 2 =
var max_period_num = CALCULATE(MAX('MF4-MFG-PBQ'[PERIOD_NUM]))
var max_fiscal_year = MAX('MF4-MFG-PBQ'[FISCAL_YEAR])
var result = CALCULATE(SUM('MF4-MFG-PBQ'[Balance]), 'MF4-MFG-PBQ'[Version.Version Level 01.Key]="1", 'MF4-MFG-PBQ'[FISCAL_YEAR]=max_fiscal_year, 'MF4-MFG-PBQ'[PERIOD_NUM]=max_period_num, ALL('MF4-MFG-PBQ'[Version.Version Level 01.Key]) )
RETURN result

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @PwC_BAN ,

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

v-yangliu-msft
Community Support
Community Support

Hi  @PwC_BAN ,

 

You can use the following dax:

MTD Actual Balance 2 =
var max_period_num = CALCULATE(MAX('MF4-MFG-PBQ'[PERIOD_NUM]))
var max_fiscal_year = MAX('MF4-MFG-PBQ'[FISCAL_YEAR])
var result =
CALCULATE(SUM('MF4-MFG-PBQ'[Balance]),
FILTER(ALL('MF4-MFG-PBQ'),
'MF4-MFG-PBQ'[Version.Version Level 01.Key]="1"&&
'MF4-MFG-PBQ'[FISCAL_YEAR]=max_fiscal_year&&'MF4-MFG-PBQ'[PERIOD_NUM]=max_period_num
))
 RETURN result

 

Best Regards,

Liu Yang

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

@v-yangliu-msft  all function is showing all other's profit centers data which are not even selected and when we use allselected it also filters the same data as previous. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.