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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
kulpowerbi
Helper I
Helper I

Comparing one measure output inside another measure is not working with If condition

I have created measure1 it generate output as T or F and I wan to reuse measure1's output inside New_Measure. But it's not working.

 

New_Measure = If ( [measure1]="T", 
CALCULATE(SUM(Sales[SalesAmount]),FILTER('Calendar','Calendar'[Year]=2015)),0)

 

I have draged measure1 in my powerbi canvas which is showing "T" as output then why my New_Measure  is showing Zeros for all the year in a chart.

kulpowerbi_0-1630340383879.png

I guess there is some problem with compareing mesausre output with "T". because if changed the formula to simply String comparision which return true; its working and showign out put for 2015 only. 

 

Measure2=
IF("T"="T", CALCULATE(SUM(Sales[SalesAmount]),FILTER('Calendar','Calendar'[Year]=2015)),0)

 


My Original measures I have combined into one for easy refrence:

M_Sales_dynamic date range for each Bookmark = 
var slider_min = MIN('Calendar'[Date])
var slider_max = max('Calendar'[Date])
var date_min = CALCULATE(MIN('Calendar'[Date]),ALL('Calendar')) 
var date_max = CALCULATE(MAX('Calendar'[Date]),ALL('Calendar')) 
var chk_minmax = IF(and(slider_min=date_min,slider_max=date_max),"T","F")
var bookmark_selection = SELECTEDVALUE(Bookmark[Bookmark])

return
IF(bookmark_selection="1", CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[QtrYr]="Q4-15")),0)

// IF(AND([M_Bookmark_Selection]="1", [Slider_Min_Max_Date]="T"), CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Year]=2015)),
// IF(AND([M_Bookmark_Selection]="2", [Slider_Min_Max_Date]="T"), CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Quarter]="Q2")),
// IF(AND([M_Bookmark_Selection]="3", [Slider_Min_Max_Date]="T"), CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Month]="May")),
// CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[WeekdayNum]=1)))))
2 REPLIES 2
amitchandak
Super User
Super User

@kulpowerbi , Try like

 

New_Measure = If ( [measure1]="T", 
CALCULATE(SUM(Sales[SalesAmount]),FILTER('Calendar','Calendar'[Year]=2015)),blank() )
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak  thanks for helping on this. I tried the measure you provided, but it's returning completly blank visaul.  

here is my PBI file, if you can help will really appricate this.

Background: I have used radio button with static table and a single column where values are stored as 1,2,3,4 .. and used bookmark to select different values in single selection slider(radio button) and used measure like this: SELECTEDVALUE(Bookmark[Bookmark])
so it tells me which bookmark is selected and based on bookmark selected I would use differnt Years or month in each hirachy in the axis.

My bookamrks  is doing Drill down for Date(Year, QTR, MONTH)

and i wan to filter default year(2015), month ="Jan", "mar", QTR="QT" only.. in my visual while opening first time.

 

Helpful resources

Announcements
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!

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.

Top Solution Authors