Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solved! Go to Solution.
@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())
@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())
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...
@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())
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 58 | |
| 45 | |
| 41 | |
| 21 | |
| 18 |