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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vitexo87
Post Prodigy
Post Prodigy

filter function charts

I have a bar graph, I need it to work as follows: By selecting any year in the filter values to be displayed in the chart must be the values of all previous years and it takes place a Texo box or similar Meeting that presents the total value of values by the year selected in the filter.

 

it is possible to do this in Power BI? if it is not possible to make a bar graph with what type of chart is possible I do this?

 

is an example of how I want to leave my graph:

 

Untitled.png

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi vitexo87,

According to your description, you want to get the records filtered by date is equal or less than your choice in slicer, right?

 

Below is my test steps:

 

 1. Create test tables.

'Sales Amount Records':

 Capture.PNG

 

‘CalendarTable’:

Dax: CalendarTable = ADDCOLUMNS( CALENDAR(MIN('Sales Amount Records'[Date]),MAX('Sales Amount Records'[Date])),"Year",YEAR([Date]),"Month",MONTH([Date]))

 Capture1.PNG

 

Relationship(Date):

Capture5.PNG

 

 2. Add measures to table.

‘Sales Amount Records’:

Não Processado = sum('Sales Amount Records'[Nao])

Processado = sum('Sales Amount Records'[Processado ])

 

‘CalendarTable’(Use to get the value of slicer):

Slicer Choice = if(HASONEVALUE(CalendarTable[Year]),MAX(CalendarTable[Year]),BLANK())

 

 3. Create a table get data from slicer.

Dax: CALCULATETABLEBYSlicer = CALCULATETABLE('Sales Amount Records',FILTER('Sales Amount Records',YEAR('Sales Amount Records'[Date]) <=[Slicer Choice]))

 

 4. Create visuals.

Slicer Year:

 Capture3.PNG

Slicer Month:

 Capture4.PNG

 

Current choice records:

 Capture6.PNG

 

Capture7.PNG

 

Requirement table:

 Capture8.PNG

Capture9.PNG

 

Test result:

Capture2.PNG

 

In summary, I found that the data which choice in slicer can’t alternately with the created table. When the dax formula initialization the table, the measure(‘Slicer Choice’) is blank. (it can’t get the value which selected in the slicer). The table’s structure will be fixed after initialization.

 

To work around the issue, you can use below two methods:

 a. Use the page level filter with “is on or before” operator

 Capture10.PNG

Capture11.PNG

 

 b. Use Timeline slicer.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft

 

I already had a calendar table, however I can not relate to any other table because the ano_id that would be the key doubles

I was trying to create a column in my Year table every time it was the year of filter values to be displayed by this new column was every year until the filtrate year.

 

i try create conditional columns, measurement, custom column but without success

Hi vitexo87,

 

>>By selecting any year in the filter values to be displayed in the chart must be the values of all previous years and it takes place a Texo box or similar Meeting that presents the total value of values by the year selected in the filter.

 

The slicer not support within feature, you can use 'page level filter' or 'timeline slicer' to achieve your requirement.


For detail info, you could refer to my previous reply.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
vitexo87
Post Prodigy
Post Prodigy

the expression that is being used in this graph

 

Não Processado = sum(Fatos[Vl_RestoNaoProcessado])

 

Processado = sum(Fatos[Vl_RestoProcessado])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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