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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors