The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi and Happy New Year 2024 to the Community.
Here is my issue: I want to display a bar chart with 2023 values
1- if the "Year" filter does not have any selection, display chart using Measure #1 (only 2023 values)
2- if the "Year" filter has a selected valye, than use Measure #2 (values conditioned by filter selection)
Thank you for your help.
Solved! Go to Solution.
Hi, @JMSNYC
Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measures:
AppearDataByYear =
VAR _slicer_count =
DISTINCTCOUNT ( 'Slicer'[Year] )
VAR _all_count =
COUNTROWS ( ALL ( 'Slicer' ) )
VAR _selcet_years =
ALLSELECTED ( 'Slicer'[Year] )
VAR _max_year =
CALCULATE ( MAX ( 'Table'[Year] ), ALL () )
VAR _filter =
SWITCH (
TRUE (),
_slicer_count = _all_count, IF ( SELECTEDVALUE ( 'Table'[Year] ) = _max_year, 1 ),
_slicer_count < _all_count, IF ( SELECTEDVALUE ( 'Table'[Year] ) IN _selcet_years, 1 )
)
RETURN
_filter
If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, @JMSNYC
Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measures:
AppearDataByYear =
VAR _slicer_count =
DISTINCTCOUNT ( 'Slicer'[Year] )
VAR _all_count =
COUNTROWS ( ALL ( 'Slicer' ) )
VAR _selcet_years =
ALLSELECTED ( 'Slicer'[Year] )
VAR _max_year =
CALCULATE ( MAX ( 'Table'[Year] ), ALL () )
VAR _filter =
SWITCH (
TRUE (),
_slicer_count = _all_count, IF ( SELECTEDVALUE ( 'Table'[Year] ) = _max_year, 1 ),
_slicer_count < _all_count, IF ( SELECTEDVALUE ( 'Table'[Year] ) IN _selcet_years, 1 )
)
RETURN
_filter
If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |