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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
hb0135
Helper III
Helper III

How to get the dynamically change in power bi card by current week wise.

Hello,
I have create a card for plan and actual delivery in power bi but for current week i need to select in filters in each week for that i need dynamic card for currrent week for below data i.e in excel till week 52.

hb0135_0-1707792914167.png

BR
HB0135

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@hb0135 , You can have date table with week rank, based on the selection

 

Have these new columns in the Date Table, Week Rank is Important in Date/Week Table

Week Rank = RANKX('Date','Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format


These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

Or based on today you can have

 

This Week Today =
var _min = today() -WEEKDAY(today() ,2) +1 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))


Last Week Today =
var _min = today() -WEEKDAY(today() ,2) -6 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

 

In case you have active inactive join you can first create a measure with userelationship

 

calculate( SUM('Table'[Amount]),USERELATIONSHIP ('Table'[Actual Delivery Date], 'Date'[Date]))

 

 

And then use week code

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

Ritaf1983
Super User
Super User

Hi @hb0135 
If you don't have a date table in your model you can use a dynamic filter - top n to take the last week
+ Filter out zeros

Ritaf1983_0-1707795679764.png

result:

Ritaf1983_1-1707795712805.png

pbix is attached

Note that this is not the best practice  .
My recommend is to learn about the data table and use it in the model.
For more information please refer :

https://www.youtube.com/watch?v=LfKm3ATibpE

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

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

5 REPLIES 5
Ritaf1983
Super User
Super User

Hi @hb0135 
If you don't have a date table in your model you can use a dynamic filter - top n to take the last week
+ Filter out zeros

Ritaf1983_0-1707795679764.png

result:

Ritaf1983_1-1707795712805.png

pbix is attached

Note that this is not the best practice  .
My recommend is to learn about the data table and use it in the model.
For more information please refer :

https://www.youtube.com/watch?v=LfKm3ATibpE

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

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hello,

Thanks for help


You're welcome 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
amitchandak
Super User
Super User

@hb0135 , You can have date table with week rank, based on the selection

 

Have these new columns in the Date Table, Week Rank is Important in Date/Week Table

Week Rank = RANKX('Date','Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format


These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

Or based on today you can have

 

This Week Today =
var _min = today() -WEEKDAY(today() ,2) +1 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))


Last Week Today =
var _min = today() -WEEKDAY(today() ,2) -6 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

 

In case you have active inactive join you can first create a measure with userelationship

 

calculate( SUM('Table'[Amount]),USERELATIONSHIP ('Table'[Actual Delivery Date], 'Date'[Date]))

 

 

And then use week code

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hello,

Thanks for help

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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