Forum Discussion
Dynamic Measure and Slicer
Hello Guys,
I want to create a dynamic measure which depends on the slicer.
When I select 19-20 my measure will show the data for that year
When I select 20-21 my measure will show the data for that year
But when I select more than 2 years I get a blank result.
How can i achieve that if i select 2 years in the slicer then i will get 2 lines for that 2 years selected and so on.
Nimai123 , for that you can add isfiltered or hasonevalue
Volume KL Dynamic19-20 =
var _cnt = countx(filter(allselected('Calendar'[FY],'Calendar'[FY] ="19-20"),'Calendar'[FY])+0
return
IF(_cnt >0 && isfiltered ('Calendar'[FY]) ,CALCULATE( SUMX(GRINetSalesDetailsBI,GRINetSalesDetailsBI[NetSales]/1000) ,'Calendar'[FY] = "19-20" ),BLANK())
3 Replies
- amitchandakSuper User
Nimai123 , I am assuming you are hiding showing like based on selection. And each measure is a line
Volume KL Dynamic19-20 =
var _cnt = countx(filter(allselected('Calendar'[FY],'Calendar'[FY] ="19-20"),'Calendar'[FY])+0
return
IF(_cnt >0 ,CALCULATE( SUMX(GRINetSalesDetailsBI,GRINetSalesDetailsBI[NetSales]/1000) ,'Calendar'[FY] = "19-20" ),BLANK())
Volume KL Dynamic 20-21=
var _cnt = countx(filter(allselected('Calendar'[FY],'Calendar'[FY] ="20-21"),'Calendar'[FY])+0
return
IF(_cnt >0 ,CALCULATE( SUMX(GRINetSalesDetailsBI,GRINetSalesDetailsBI[NetSales]/1000) ,'Calendar'[FY] = "20-21" ),BLANK())- Nimai123Post Patron
Hello amitchandak
Yes, I am hiding and showing based on the selection in the slicer and each line is a measure.
When I am not selecting any year from the slicer I should get a blank result, but I am getting both the lines by using the above measures
When I select 1 year I should get one line and when 2 I should get 2 lines and so on...
- amitchandakSuper User
Nimai123 , for that you can add isfiltered or hasonevalue
Volume KL Dynamic19-20 =
var _cnt = countx(filter(allselected('Calendar'[FY],'Calendar'[FY] ="19-20"),'Calendar'[FY])+0
return
IF(_cnt >0 && isfiltered ('Calendar'[FY]) ,CALCULATE( SUMX(GRINetSalesDetailsBI,GRINetSalesDetailsBI[NetSales]/1000) ,'Calendar'[FY] = "19-20" ),BLANK())