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
Dronning
New Member

Dax help

Screenshot 2025-02-04 091541.pngScreenshot 2025-02-04 091623.png

DateValueSupplier
2025-01-0120S1
2025-01-0123S1
2025-01-0338S1
2025-01-0352S1
2025-01-0112S1
2025-01-0323S1
2025-01-0464S1
2025-01-0114S2
2025-01-0494S2


I have this data. And i have created a countionuse date table in power bi. 
And i also have two numeric decimal parameters that goes from 0 to 2 in steps of 0.01 called S1Factor and S2Factor

My problem is that i want to create a stacked bar chart based on Date and two measures one measure that filters on Supplier = S1 and another that is based on Supplier= S2.
i want a part of  my measure to do something like this. 
MeasureS1 = CALCULATE(SUM('Tabel[Value] )* SELECTEDVALUE( S1Factor[S1]) , FILTER( 'Table' , 'Table'[Supplier]= "S1"))
So based on what decimal number i chose in the slicer for the parameter S1 Factor that number shall multiply the 'Table'[value].
And this works as intended

However the big problem is that i also want to make my MeasureS1 to only make the multiplication on the values that has the corresponding dates that is chosen in a dateslicer. So if i for example only chose the Date = 2025-01-01 & 2025-01-03 i only want the multiplication by the factor to happen for those two dates. But i always want all data to be visible even the date that is not chosen in the slicer.
So basically i want in the stacked barchart is that the staples for the chosen dates in the slicer 2025-01-01 & 2025-01-03 to change based on S1factor slicer. And the not chosen date in the date slicer 2025-01-04 to still have a bar in the visualisation but not be changed by the factor.


As you can see in the pictures all the bars changes when i change the factor S1 i only want the bars for 2025-01-01 & 2025-01-03 to change and 2025-01-04 to still be visable but not factored.




Thanks in advance



2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @Dronning ,

 

You need to create a table with dates value to use on a slicer then use the following changes to your measures:

MeasureS1 = IF(
			SELECTEDVALUE('Table'[Date]) IN VALUES(Dates[Date]),
			CALCULATE(
				SUM('Table'[Value]) * SELECTEDVALUE(S1Factor[S1]),
				FILTER(
					'Table',
					'Table'[Supplier] = "S1"
				)
			),
			CALCULATE(
				SUM('Table'[Value]),
				'Table'[Supplier] = "S1"
			)
		)

 

MFelix_0-1738679484447.png

 

Chexh file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

parry2k
Super User
Super User

@Dronning My friend @MFelix has given an awesome solution, here is another version of the calculation. This will show the total correctly in the table visual if you ever decide to visualize using matrix/table visual otherwise please follow what @MFelix provided. Cheers!

 

Measure S1 = 
VAR __SelectedDates = VALUES ( 'Date Slicer'[Date] )
RETURN
SUMX (
    FILTER ( 
        Supplier,
        Supplier[Supplier] = "S1" 
    ),
    VAR __S1ParameterValue = IF ( Supplier[Date] IN __SelectedDates,  SELECTEDVALUE(S1Factor[S1]), 1 )
    VAR __Value = Supplier[Value] * __S1ParameterValue
    RETURN
    __Value
)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
Dronning
New Member

Thank you very much, great solution 🙂

parry2k
Super User
Super User

@MFelix understood. You are the best. Cheers!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Dronning My friend @MFelix has given an awesome solution, here is another version of the calculation. This will show the total correctly in the table visual if you ever decide to visualize using matrix/table visual otherwise please follow what @MFelix provided. Cheers!

 

Measure S1 = 
VAR __SelectedDates = VALUES ( 'Date Slicer'[Date] )
RETURN
SUMX (
    FILTER ( 
        Supplier,
        Supplier[Supplier] = "S1" 
    ),
    VAR __S1ParameterValue = IF ( Supplier[Date] IN __SelectedDates,  SELECTEDVALUE(S1Factor[S1]), 1 )
    VAR __Value = Supplier[Value] * __S1ParameterValue
    RETURN
    __Value
)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k ,

 

You are correct about the SUMX because of the line total on the matrix, since the visual was a bar chart I never even added that option.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @Dronning ,

 

You need to create a table with dates value to use on a slicer then use the following changes to your measures:

MeasureS1 = IF(
			SELECTEDVALUE('Table'[Date]) IN VALUES(Dates[Date]),
			CALCULATE(
				SUM('Table'[Value]) * SELECTEDVALUE(S1Factor[S1]),
				FILTER(
					'Table',
					'Table'[Supplier] = "S1"
				)
			),
			CALCULATE(
				SUM('Table'[Value]),
				'Table'[Supplier] = "S1"
			)
		)

 

MFelix_0-1738679484447.png

 

Chexh file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.