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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
KL007
Regular Visitor

Creating a metric to show whether refresh has been pressed in the current month

Hi all,

 

I'm trying to create a visualisation to show the users of my BI Dashboard that the dataset has been refreshed this month. My idea was to use a table that contains the Column "Last Refresh" that updates it to the current date whenever it is refreshed. Then create a new table that checks wether the "Last Refresh" is within the current month, if it is then "Last Refresh Status" = 1, if not 0 (or something like that). 

For that I'm using the following DAX code, but the underlined values all contain errors (incorrect parameter type/cannot find):

Status Table =
ADDCOLUMNS(
    DimDate,
    "Last Refresh",
    RELATED('Monthly Refresh'[Monthly Refresh Month]),
    "Refresh Status Measure",
    IF([CurrentMonth] = 1 && [Last Refresh] >= STARTOFMONTH(TODAY()), "Green", "Red")
)

Any suggestions on how to improve this?

Thanks,


KL007
2 REPLIES 2
manvishah17
Resolver I
Resolver I

Hi  ,You can try this measure

Status Table =
ADDCOLUMNS(
DimDate,
"Last Refresh",
CALCULATE(MAX('Monthly Refresh'[Monthly Refresh Month])),
"CurrentMonth",
IF(
YEAR(CALCULATE(MAX('Monthly Refresh'[Monthly Refresh Month]))) = YEAR(TODAY()) &&
MONTH(CALCULATE(MAX('Monthly Refresh'[Monthly Refresh Month]))) = MONTH(TODAY()),
1,
0
),
"Refresh Status Measure",
IF(
[CurrentMonth] = 1 && [Last Refresh] >= STARTOFMONTH(TODAY()),
"Green",
"Red"
)
)

 

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!

halfglassdarkly
Responsive Resident
Responsive Resident

I could be wrong but I suspect RELATED wouldn't work here as 'Status Table' isn't going to have any relationship to 'Monthly Refresh' until after the table is calculated and you create the relationship. You could try:

 

    "Last Refresh",
    Max('Monthly Refresh'[Monthly Refresh Month]),

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.