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
DharmaChinta
Frequent Visitor

Table visual to show only current week Data By default without any filter

Hi Team,

 

Is there a way to show only One week Data By default without any filter on a table visual and based on the week selection change accordingly ? May be a DAX that just filter on the current week ? I am new to power BI and need this functionality . Thanks in advance . Currently that table has 12 weeks of data by default .

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @DharmaChinta,

Try to create a measure like this


Measure =
CALCULATE (
SUM ( Table[Column] );
FILTER (
ALL ( Table[DateColumn] );
WEEKNUM ( Table[DateColumn] ) = WEEKNUM ( TODAY () )
)
)


Regards,
MFelix

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

v-jiascu-msft
Employee
Employee

Hi @DharmaChinta,

 

If you still want the slicers to work on it, you can try the measure below.

 

Measure =
VAR selectedWeek =
    SELECTEDVALUE ( 'calendar'[week] )
RETURN
    IF (
        ISBLANK ( selectedWeek ),
        CALCULATE (
            SUM ( 'table'[value] ),
            FILTER ( calendar, WEEKNUM ( 'calendar'[date], 2 ) = WEEKNUM ( TODAY (), 2 ) )
        ),
        CALCULATE (
            SUM ( 'table'[value] ),
            FILTER ( calendar, WEEKNUM ( 'calendar'[date], 2 ) = selectedWeek )
        )
    )

 

Best Regards,
Dale

Community Support Team _ Dale
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

7 REPLIES 7
v-jiascu-msft
Employee
Employee

Hi @DharmaChinta,

 

If you still want the slicers to work on it, you can try the measure below.

 

Measure =
VAR selectedWeek =
    SELECTEDVALUE ( 'calendar'[week] )
RETURN
    IF (
        ISBLANK ( selectedWeek ),
        CALCULATE (
            SUM ( 'table'[value] ),
            FILTER ( calendar, WEEKNUM ( 'calendar'[date], 2 ) = WEEKNUM ( TODAY (), 2 ) )
        ),
        CALCULATE (
            SUM ( 'table'[value] ),
            FILTER ( calendar, WEEKNUM ( 'calendar'[date], 2 ) = selectedWeek )
        )
    )

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MFelix
Super User
Super User

Hi @DharmaChinta,

Try to create a measure like this


Measure =
CALCULATE (
SUM ( Table[Column] );
FILTER (
ALL ( Table[DateColumn] );
WEEKNUM ( Table[DateColumn] ) = WEEKNUM ( TODAY () )
)
)


Regards,
MFelix

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



Anonymous
Not applicable

To add also the current year:

Measure = CALCULATE ( SUM ( Table[Column] ); FILTER ( ALL ( Table[DateColumn] ); WEEKNUM ( Table[DateColumn] ) = WEEKNUM ( TODAY () ) && YEAR ( Table[DateColumn] ) = YEAR ( TODAY () ) ) )

Thanks a lot! 

Sorry I deleted your answer by accident

Is it possible have sales till yesterday instead till today?

Hi,

Subtract 1 from TODAY() i.e. TODAY()-1 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Is this also possible for the current week and the current year? I have multiple years.

Hi @Anonymous 

 

You need to add the year to the filter part of the measure:

 

Measure =
CALCULATE (
SUM ( Table[Column] );
FILTER (
ALL ( Table[DateColumn] );
WEEKNUM ( Table[DateColumn] ) = WEEKNUM ( TODAY () )
&&
YEAR ( Table[DateColumn] ) = YEAR ( TODAY () )
)
)

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
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.