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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Uhan1101
Frequent Visitor

Add selected number of days to a date - using HASONEVALUE

Hi!

I've trying to make a slicer with a numbers of days (1 - 10) which I want to add to a date column, so the user can see the sum for the day + 1-10 days. 

The number of days I've just added in a not related table, so I was thinking of using HASONEVALUE, but it's not working.

 

The formel I'm trying to use is;

Add_days = if(HASONEVALUE('Dage'[Antal dage]);VALUES(Dage[Antal dage])+VALUES(test_kpi1_0301[LEVERINGS_DATO]))

 

I'm using direct query to my data

 

Can anybody help me

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Uhan1101 , If you try add that to new column that is not possible. In case of measure you can try

 

if(Isfiltered('Dage'[Antal dage]) && HASONEVALUE('Dage'[Antal dage]), Max(Table[Date])+ Selectedvalues('Dage'[Antal dage]) , Max(Table[Date]))

 

 

You can use one of the two as per need isfiltered or hasonevalue

https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

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

View solution in original post

Anonymous
Not applicable

Hi  @Uhan1101 ,

I created some data:

vyangliumsft_0-1652768923751.png

Here are the steps you can follow:

1. Select Modeling – New Parameter.

vyangliumsft_1-1652768923754.png

2. Create measure.

Measure =
MAX('Table'[Date]) + [Slicer_Day Value]

3. Result:

vyangliumsft_2-1652768923756.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Uhan1101 ,

I created some data:

vyangliumsft_0-1652768923751.png

Here are the steps you can follow:

1. Select Modeling – New Parameter.

vyangliumsft_1-1652768923754.png

2. Create measure.

Measure =
MAX('Table'[Date]) + [Slicer_Day Value]

3. Result:

vyangliumsft_2-1652768923756.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@Uhan1101 , If you try add that to new column that is not possible. In case of measure you can try

 

if(Isfiltered('Dage'[Antal dage]) && HASONEVALUE('Dage'[Antal dage]), Max(Table[Date])+ Selectedvalues('Dage'[Antal dage]) , Max(Table[Date]))

 

 

You can use one of the two as per need isfiltered or hasonevalue

https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.