cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GiangShiro
New Member

Cannot filter measure in case of TOTAL

Hi expert,

 

I am stucking on this issue for 2 days, could you please help?

I have a measure like this:

 

Actual1 =
Var Var_REPORT_TYPE = "02"
Var Var_RATE_TYPE_CD = "02"
Var Var_Actual_By_Region =
CALCULATE(SUM(Table1[AMT])
,FILTER('Table1',[REPORT_TY] = Var_REPORT_TYPE)
,FILTER('Table1',[RATE_TYPE_CD] = IF(HASONEVALUE(FORBI_M_RATE_TYPE[RATE_TYPE_CD]),MAX(RateMaster[RATE_TYPE_CD]),Var_RATE_TYPE_CD))
,FILTER(Table1,[REGION_NM] = VALUES(RegionMaster[REGION_NM]))
,FILTER(IndicatorTBL,IndicatorTBL[TOTAL_DISPLAY_FLG]=1)
)
Return
--Actual by Actual (in case blank, return 0)
IF(VALUES(RegionMaster[REGION_NM]) <> "TOTAL"
,IF(
LOOKUPVALUE(
IndicatorTBL[TOTAL_DISPLAY_FLG]
,IndicatorTBL[BI_INDICATOR_CD]
,MAX(Table1[BI_INDICATOR_CD]))=1
,Var_Actual_By_Region+0
,Var_Actual_By_Region)
--TOTAL's Actual 
,CALCULATE(
CALCULATE(SUM(Table1[AMT])
,FILTER('Table1',[REPORT_TY] = Var_REPORT_TYPE)
,FILTER('Table1',[RATE_TYPE_CD] = IF(HASONEVALUE(RateMaster[RATE_TYPE_CD]),MAX(RateMaster[RATE_TYPE_CD]),Var_RATE_TYPE_CD)))
,ALL(RegionMaster)
)+0
)

 

And then, I need to get specific data out of the above measure, so I use the below measure

 

ActualPL_1a =
Var Var_BI_INDICATOR_CD = "1a"
Var Var_REPORT_TYPE = "02"
Var Var_RATE_TYPE_CD = "02"
var test = [Actual1]
Return
IF(VALUES(V_FORBI_M_BI_REGION_PL[REGION_NM]) <> "TOTAL"
,CALCULATE(
CALCULATE(
[Actual1]
,FILTER(Table1,[BI_INDICATOR_CD] = Var_BI_INDICATOR_CD)
)
,ALL(IndicatorTBL)
)
,
CALCULATE(
CALCULATE(
test
,FILTER(Table1,[BI_INDICATOR_CD] = Var_BI_INDICATOR_CD)
)
,ALL(IndicatorTBL)
,ALL(RegionMaster)
)
)

 

In ActualPL_1a, for the TRUE part of the if (<> "TOTAL" is true) works well (can filter indicator code = '1a'), but for the FALSE part of the IF (In case of TOTAL), the data cannot be filtered by indicator code (=1a) as well as ALL(IndicatorTBL)

 

Can anyone help me :(((

 

Thank so much

3 REPLIES 3
GiangShiro
New Member

sorry, I don't think HASONEVALUE works there.

tamerj1
Community Champion
Community Champion

@GiangShiro 
Please provide more details about your visual, perhaps a screenshot to find out what possibly works.

tamerj1
Community Champion
Community Champion

Hi @GiangShiro 

you can use 

IF ( HASONEVALUE ( the column that you are slicing by ), regular calculation, total calculation )

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors