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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
lcfaria
Helper II
Helper II

Previous data from a slicer selection - How to show 0 instead blank?

Hi all,

 

I created a solution to bring in the last 4 sprints based on the selection, exactly as explained by Alberto Ferrari in the link below:
https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/

 

Things worked fine, but I'm facing a situation.
The result below is what I got, but notice that I don't have data for Sprint 20 and I would like 0 to be returned in this case:

lcfaria_5-1652988509458.png

 

I tried to add 0 to my measure, but this made the values of the other sprints that shouldn't appear, start to appear with the value 0.

As I have the Sprint 21 selected, it should appear only Sprints 18, 19, 20 and 21.

lcfaria_3-1652988297250.png

The result I expect is this, but how to do it dinamically, I didn't find a solution:

lcfaria_4-1652988417460.png

I tried a way to find the minimum value of my sprint that appears in my chart (in my case, with the selection in sprint 21, it should get sprint 18), so I could use that as a filter, but I didn't find a way to reach this value.

 

Link to the file: https://1drv.ms/u/s!At5JlMR_naI1gf4xP2uHwDmcf3fgcA?e=M5cme9

 

Thanks for your help!

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi @lcfaria,

 

could you try writing your measure like this:

Sum Value = var _tmp = SUM('fact'[Value]) 
var _sprint = CALCULATE(SELECTEDVALUE('calendar'[Sprint]))
return
_tmp + IF(NOT(ISBLANK(_sprint)),0,BLANK())

 

cheers,
Sturla

 

View solution in original post

2 REPLIES 2
sturlaws
Resident Rockstar
Resident Rockstar

Hi @lcfaria,

 

could you try writing your measure like this:

Sum Value = var _tmp = SUM('fact'[Value]) 
var _sprint = CALCULATE(SELECTEDVALUE('calendar'[Sprint]))
return
_tmp + IF(NOT(ISBLANK(_sprint)),0,BLANK())

 

cheers,
Sturla

 

@sturlawsof course, exactly as expected!!!! Thank's a lot!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors