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
Anonymous
Not applicable

Measure based on selected hierarchy

Hi, 

 

I have a question that is more related to the Tabular model and Excel connected to that model then Power BI but it's still viable in Power BI. My model is 3 tables: Date creation, Date resolution and issues (below)

 

ID | Created Date | Resolution Date| Resolution

1  |2019-09-01     | 2019-09-02       | Done

2  |2019-09-01     |                           |

3  |2019-09-01     | 2019-09-02       | Won't Fix

4  |2019-09-01     |                           |

 

The active relation is Date creation > Issue and Date resolution > Issue. There are two measures in Issue table 

 

Issue created count:= COUNTROWS ( Issue )
Issue resolved count:=
    CALCULATE (
        COUNTROWS ( Issue );
        FILTER ( Issue; Issue[Resolution] <> BLANK () )
    )

 

And now for the main question: Is there any way of showing values or blank depending on which calendar is chosen on rows/columns? What I need is when the user connects from Excel and chose Date resolution, the "Issue resolved count" should show values but "Issue created count" should show blank. Also when the user chose the Date creation, the "Issue resolved count" should show blank but "Issue created count" should show values. When no calendar is selected then both values should be shown.

1 REPLY 1
Anonymous
Not applicable

-- DAX rule number 1: NEVER filter a table
-- when you can filter a column.

-- measure 1 (internal, hidden)
[_IssuesCreated] = COUNTROWS ( Issue )

-- measure 2 (internal, hidden)
[_IssuesResolved] =
	calculate(
		[_IssuesCreated],
		keepfilters ( not isblank( Issue[Resolution] ) )
	)
	
-- measure 3
[Calendar Chosen] =
var __creation = isfiltered( 'Creation Dates' )
var __resolution = isfiltered( 'Resolution Dates' )
var __both = __creation && __resolution
return
	switch( true(),
		__both, "both",
		__creation, "creation",
		__resolution, "resolution",
		"none"
	)
	
-- measure 4
[Issues Resolved] =
var __calendarChosen = [Calendar Chosen]
var __value = [_IssuesResolved] 
return
	switch( true(),
		__calendarChosen in {"both", "creation"}, blank(),
		__calendarChosen in {"resolution", "none"}, __value,
		blank() // just in case but should not happen
	)

-- measure 5
[Issues Created] =
var __calendarChosen = [Calendar Chosen]
var __value = [_IssuesCreated] 
return
	switch( true(),
		__calendarChosen in {"both", "creation"}, __value,
		__calendarChosen in {"resolution", "none"}, blank(),
		blank() // just in case but should not happen
	)

Best

D.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.