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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Analystdata
Frequent Visitor

Toggle values of the table

Hi Everyone!

I am reaching out to seek assistance with implementing a slicer in Power BI. The objective is to create a slicer with values 0 and 1, where selecting 0 will hide entire rows where the sum of values (Amount + X + Y + Z + XZY) equals 0, and selecting 1 will display the entire table.

I have attached a snippet for your reference.

 AmountXYZXZY
REVENUE     
GROSS SALES28686415.91.00321773771.00299203039.4
SALES COMMISSION INCOME00000
RENT REVENUE00000
LESS: SALES RETURNS & ALLOWANCE/DISCOUNT-7108.57-0.003-6483.87-0.00299-624.7
NET SALES2373307.31121708931202414.7

 

Your expertise in resolving this issue would be highly appreciated.
Thank you in advance for your valuable assistance.

1 ACCEPTED SOLUTION
v-linyulu-msft
Community Support
Community Support

Thanks for the reply from @ray_aramburo , please allow me to provide another insight:
Hi,@ray_aramburo 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1716199703289.png

 

vlinyulumsft_1-1716199703290.png

2. Below are the measure I've created for your needs:

 

Measure = 
VAR SELCET=SELECTEDVALUE(CHOICE[Column1])
RETURN IF(SELCET=0,IF(CALCULATE(SUM('Table'[Column3]),FILTER(ALLSELECTED('Table'),'Table'[Column1]=MAX('Table'[Column1])))=0,1,0),1)

 

3.Add mesure to the filtered view:

vlinyulumsft_2-1716199744424.png

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_3-1716199760689.png

vlinyulumsft_4-1716199760691.png

Best Regards,

Leroy Lu

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

4 REPLIES 4
v-linyulu-msft
Community Support
Community Support

Thanks for the reply from @ray_aramburo , please allow me to provide another insight:
Hi,@ray_aramburo 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1716199703289.png

 

vlinyulumsft_1-1716199703290.png

2. Below are the measure I've created for your needs:

 

Measure = 
VAR SELCET=SELECTEDVALUE(CHOICE[Column1])
RETURN IF(SELCET=0,IF(CALCULATE(SUM('Table'[Column3]),FILTER(ALLSELECTED('Table'),'Table'[Column1]=MAX('Table'[Column1])))=0,1,0),1)

 

3.Add mesure to the filtered view:

vlinyulumsft_2-1716199744424.png

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_3-1716199760689.png

vlinyulumsft_4-1716199760691.png

Best Regards,

Leroy Lu

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

 

Analystdata
Frequent Visitor

Hi @ray_aramburo, Thank you for the response. But we do have slicers like Year and Month affecting the table, In that case, would it be difficult to take this route of creating Bookmarks? Could you please suggest us a dynamic path for the same. 

Year and Month slicers are being used as a visual or as part of the Filters pane?





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





ray_aramburo
Super User
Super User

I may suggest a different approach, if you have the measure already created for the sum of values = 0, great. Use that measure as a visual filter for when measure is not 0. Then, go to Bookmarks and create a Bookmark capturing the state of the table with the filter. Then, delete the filter and create a new Bookmark with this new state. Use the bookmark navigator button to show those 2 and that's it 🙂 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.