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
Anonymous
Not applicable

Creating an iterative measurement

Hi everybody,

i hope someone could help me or give me a hint how to slove my problem of creating a measurement.

 

Situation:

I want to create a measurement, which calculated the coverage of my stock against my forecasted demand. In Access a build up a data base, which contain a "master data" table, a "stock" table and a "demand" table. I create a left outer join on the key of material to conect the table form master data to stock to demand.

Example of Querry: 

MaterialStock DateDemandDateDescription of Querry outputSolution of measurement
10000(No Stock and Demand Data, only master data available)0
1031.12.1800(No demand Data only master data and stock data available) 0
210031.12.182031.01.19(Normal case, scenario 1)1
210031.12.182020.01.19
210031.12.182010.01.19
210031.12.182028.02.19
210031.12.182020.02.19
210031.12.182010.02.19
310031.12.18031.01.19(No Demand, scenario 2) 99
310031.12.18020.01.19
310031.12.18010.01.19
410031.12.18031.01.19(Sum of Demand < stock , scenario 3) 98
410031.12.18020.01.19
410031.12.182010.01.19

Problems:

The first problem is that the demand data is on a weekly base i want to sum it up to a monthly base. I try to created a calculated colum, but my solution give me only the sum of an month and not the sum of an month on an material level.

Second problem is, if I get the demand on an weekly base should the formular reduce my stock level (max of material, because of multiple rows) iterative month by month until the stock level is equal or smaller then 0. (I think a normal count with an constraints count until Stock level is =<0 should give me the right answer).

Additional problem to the second problem:

I have more scenarions (if-clauses).

First (Normal case): If my Stock is after reducing the demand <= 0, then give me the counted mounth until the stock is 0.

Second (No Demand): If my Stock will not be reduced by demand (sum of all demand over time is 0), then should the formular should give me a constant value of "99".

Third (Sum Demand < stock): If the forcasted demand over is smaller then the stock (example stock:100 pc.Demandofmonth1=50 Demandofmonth2=30, Demandofmonth3=19, Demandofmonth4=0, Demandofmonth5=0 and so on stock will be stay on the level of 1 pc), then the formular should give out the constant value of "98".

 

I hope someone could help me.

Wishes sacor

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

>>Is it possible to create an count colum on a monthly base?

Please try to use following formula, it will count all same source based on material column and year month:

Count of Measurement =
CALCULATE (
    COUNT ( Table[Measurement] ),
    FILTER (
        ALL ( Table ),
        Table[Material] = EARLIER ( Table[Material] )
            && Table[Measurement] = EARLIER ( Table[Measurement] )
            && FORMAT ( Table[Demand Date], "yyyymm" )
                = FORMAT ( EARLIER ( Table[Demand Date] ), "yyyymm" )
    )
)

 

>>In the End I want to see in Pivot table which is feed form PowerBI the following Results:

You can create a table visual with material, stock columns and count column with 'max' summary mode.


Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

I add a calculated column to calculate remain stock amount, I think you can condition if statement based on stock amount, demand amount and remain amount to return corresponding measurement flag.

 

Calculate column formulas:

 

Remain = 
[Stock]
    - CALCULATE (
        SUM ( Table1[Demand] ),
        FILTER (
            ALL ( Table1 ),
            [Material] = EARLIER ( [Material] )
                && [Demand Date] <= EARLIER ( [Demand Date] )
        )
    )

Measurement = IF([Stock]=0,0,IF([Demand]=0,99,if([Remain]>=0,98,0)))

20.png

 

 

Measurement flag comment:
No stock or no remain, flag 0;
Has stock but no demand, flag 99;
Normal stock change, flag 98

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hi @v-shex-msft,

 

thank you for your fast respond and the soltion for the measurment flag it works fine after update my excel version from 32-bit to 64-bit and extend my ram to 16GB. (80 Millions rows was to much for Excel)

 

Is it possible to create an count colum on a monthly base? See my example table I hope u got my point and its not to confusing.

MaterialStock DateDemandDateRemainSolution of Count (Coverage in Month)
1031.12.18501.01.19-50
1031.12.18510.01.19-100
1031.12.18519.01.19-150
1031.12.18528.01.19-200
1031.12.18506.02.19-250
1031.12.18515.02.19-300
1031.12.18524.02.19-350
1031.12.18505.03.19-400
1031.12.18514.03.19-450
1031.12.18523.03.19-500
1031.12.18501.04.19-550
1031.12.18510.04.19-600
1031.12.18519.04.19-650
1031.12.18528.04.19-700
1031.12.18507.05.19-750
1031.12.18516.05.19-800
1031.12.18525.05.19-850
25031.12.18501.01.19451
25031.12.18510.01.19401
25031.12.18519.01.19351
25031.12.18528.01.19301
25031.12.18506.02.19252
25031.12.18515.02.19202
25031.12.18524.02.19152
25031.12.18505.03.19103
25031.12.18514.03.1953
25031.12.18523.03.1903
25031.12.18501.04.19-53
25031.12.18510.04.19-103
25031.12.18519.04.19-153
25031.12.18528.04.19-203
25031.12.18507.05.19-253
25031.12.18516.05.19-303
25031.12.18525.05.19-353
310031.12.18501.01.19951
310031.12.18510.01.19901
310031.12.18519.01.19851
310031.12.18528.01.19801
310031.12.18506.02.19752
310031.12.18515.02.19702
310031.12.18524.02.19652
310031.12.18505.03.19603
310031.12.18514.03.19553
310031.12.18523.03.19503
310031.12.18501.04.19454
310031.12.18510.04.19404
310031.12.18519.04.19354
310031.12.18528.04.19304
310031.12.18507.05.19255
310031.12.18516.05.19205
310031.12.18525.05.19155

 

In the End I want to see in Pivot table which is feed form PowerBI the following Results:

MaterialMax from StockMax from Count (Coverage)
100
2503
31005

Hi @Anonymous,

 

>>Is it possible to create an count colum on a monthly base?

Please try to use following formula, it will count all same source based on material column and year month:

Count of Measurement =
CALCULATE (
    COUNT ( Table[Measurement] ),
    FILTER (
        ALL ( Table ),
        Table[Material] = EARLIER ( Table[Material] )
            && Table[Measurement] = EARLIER ( Table[Measurement] )
            && FORMAT ( Table[Demand Date], "yyyymm" )
                = FORMAT ( EARLIER ( Table[Demand Date] ), "yyyymm" )
    )
)

 

>>In the End I want to see in Pivot table which is feed form PowerBI the following Results:

You can create a table visual with material, stock columns and count column with 'max' summary mode.


Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

thank you for your fast responds and helpfully support.

 

Wishes

Niko

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.