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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
SKC18
Frequent Visitor

Turning Measure into Column

Fill Category Measure =
VAR DaysDifference = [Days Between Fills] -- Reference your average days between fills measure
RETURN
    SWITCH(
        TRUE(),
        ISBLANK(DaysDifference), "No Data",
        DaysDifference <= 5, "Less than or equal to 5 days",
        DaysDifference > 5 && DaysDifference <= 30, "6 to 30 days",
        DaysDifference > 30 && DaysDifference <= 60, "31 to 60 days",
        DaysDifference > 60 && DaysDifference <= 90, "61 to 90 days",
        DaysDifference > 90, "Greater than 90 days",
        "Unknown"
this above code dynamically changes arrording to date range with the day between fill =
VAR CurrentDay = MAX(FillEfficiency[Day]) -- Maximum day in the current filter context
VAR CurrentAsset = SELECTEDVALUE(FillEfficiency[asset_name]) -- Single value for the current asset
VAR PreviousFillDate =
    CALCULATE(
        MAX(FillEfficiency[Day]),
        FillEfficiency[asset_name] = CurrentAsset, -- Same asset
        FillEfficiency[Day] < CurrentDay -- Earlier dates only
    )
RETURN
    IF(
        ISBLANK(CurrentAsset) || ISBLANK(PreviousFillDate),
        BLANK(), -- No previous fill exists
        DATEDIFF(PreviousFillDate, CurrentDay, DAY)
    ) But I want a column for it so that it can show the number of asset in a particular area of fill date  SKC18_0-1736414043386.png

But as it is a measure the results are only showing up like this 

SKC18_1-1736414086508.png

 

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @SKC18  - you can create a  new calculated column in your table: replace with your table name and fields. 

 

rajendraongole1_0-1736420698915.png

 

 

DaysBetweenCategory =
VAR CurrentDay = FillEfficiency[Day] -- Current day for each row
VAR CurrentAsset = FillEfficiency[asset_name] -- Asset for each row
VAR PreviousFillDate =
    CALCULATE(
        MAX(FillEfficiency[Day]),
        FILTER(
            FillEfficiency,
            FillEfficiency[asset_name] = CurrentAsset &&
            FillEfficiency[Day] < CurrentDay
        )
    )
VAR DaysDifference =
    IF(
        ISBLANK(CurrentAsset) || ISBLANK(PreviousFillDate),
        BLANK(), -- No previous fill exists
        DATEDIFF(PreviousFillDate, CurrentDay, DAY)
    )
RETURN
    SWITCH(
        TRUE(),
        ISBLANK(DaysDifference), "No Data",
        DaysDifference <= 5, "Less than or equal to 5 days",
        DaysDifference > 5 && DaysDifference <= 30, "6 to 30 days",
        DaysDifference > 30 && DaysDifference <= 60, "31 to 60 days",
        DaysDifference > 60 && DaysDifference <= 90, "61 to 90 days",
        DaysDifference > 90, "Greater than 90 days",
        "Unknown"
    )




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





This is the thing that I did in the next step to find the solution but if same assets repeats in a date then same asset name will have different frequency of the day between fill 

SKC18_0-1736487071000.png

 

Anonymous
Not applicable

Hi @SKC18 

 

Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution.

You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.