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
shorif2000
New Member

How to simplify DAX measure

Hello, I am new to powerbi and would like to know how I can simply the following piece of code in my measure. This is being used in many different places with slight different variable string such as "incident"

 

 

 

var Type = "Incident"

var OpenIncidents = countrows(filter(all(Master), Master[Ticket_Type] = Type ))

return If(ISBLANK(OpenIncidents),0,OpenIncidents)

 

 

 

The filter line is the same in all measure except for the value "Incident"

 

4 REPLIES 4
FreemanZ
Super User
Super User

hi @shorif2000 

when you say "This is being used in many different places with slight different variable string such as "incident"", how are the measures being used? Individually or collectively?

I use it in report page as a cell value. i have duplicated reports where the

 

Type 

 

value changes. I was wondering how i can make this dynamic Like:

 

 

filterRows(type=incident){

return (int) run query(type)
}



measure 1 = filterRows(inc)

measure 2 = filterRows(chg)

measure 3 = filterRows(req)

 

can you make a screenshot indicating the rows and/or columns of the mentioned cell?

Screenshot 2023-03-09 091108.png

all the cells run similair query

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.