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
asjones
Helper IV
Helper IV

Macro or Variable For Reuseing Filters in CALCULATE

I have to create several CALCULATE() statements both off actual expense and different budget types etc.  I have several sets of filters that I need to apply in CALCULATE. I was wondering if there was a creative way to write the filters "once" and reuse them almost like a variable?  That way if they do change I only change one spot, I don't risk typos and it is just cleaner.

so calcualte mgiht look like  Calculate (<expression> , EXPENSE_TYPE)
and EXPENSE_TYPE would be replaced with something like

KEEPFILTERS (
VALUE ( 'Head Account Relations'[Head Account] ) >= 50000
&& VALUE ( 'Head Account Relations'[Head Account] ) <= 79999
&& VALUE ( 'Head Account Relations'[Head Account] ) <> 56950
),
KEEPFILTERS (
VALUE ( 'Financial Actuals Table'[Account] ) <> 96910
&& VALUE ( 'Financial Actuals Table'[Account] ) <> 96950
) ,
KEEPFILTERS( VALUE('Main Project Master File - PMF'[PMF Project Type] ) >= 30 &&
VALUE( 'Main Project Master File - PMF'[PMF Project Type] ) <= 69
)

 

Any ideas or thoughts?

 

I would think this is something others wold want.

 

thanks

 

Alan

 

 

4 REPLIES 4
v-deddai1-msft
Community Support
Community Support

Hi @asjones ,

 

As far as I know,  It can't be achieved in Power BI. Calculation group is the best way to fit your ideas.

 

Best Regards,

Dedmon Dai

PaulDBrown
Community Champion
Community Champion

@asjones 

Very rudimentary, but I use a word doc/notepad for this and copy/paste. But it would be great if there was the option within PBI for sure.

(another option is to have a report page with text boxes to copy and paste from)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






asjones
Helper IV
Helper IV

I think calculation groups are opposite of what I am after.
I posted the question on the Guy in a Cube Live Discussion.  They gave a different possible solution that i am confused on, but said otherwise it does not exist. See the video linked ot the time of the question

https://youtu.be/hLQ5St1g4S4?t=1047

 

DataInsights
Super User
Super User

@asjones,

 

See the link below on calculation groups.

 

https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.