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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

get semi-additive measure value for each date level

 

Hello, I hope you are doing well!

 

I have posted this before but I didn't get an answer; I'm blocked and I need help.

 

I have a SSAS tabular model , based only on one table named 360ST, that contains the following measures:

-new orders,

-commissioning ( installation at client site) of new orders

-current orders ( current orders under production); 360ST[order number] is the column that holds the number of orders.

 

the current orders is a non additive measure:

- its value at year level is the value for the last week in the year

- its value at month level is the value for the last week in that month

- its value at week level is the aggregation by week

 

I have other attributs like duty cycle ( creation, modification, termination)  production entity...

 

I need also to visualise the current orders measure by these descriptive fields ( the measure can be aggregated by these fields)

 

I dont have a separate date table; I have year , semester, month and week period columns within the 360ST table.

I created flags in the 360ST table that store the  last week of each  month and last week of the year.

 

I have created the current orders measure like this :

 

var Total current orders = sum('360ST'[order number])

VAR year current orders = CALCULATE (

SUM ( '360ST'[order number])
,'360ST'[last week of the year] = 1
, ALLEXCEPT('360ST','360ST'[year],'360ST'[last week of the year] )
)

VAR Month current orders =

CALCULATE (

SUM ( '360ST'[order number])
, '360ST'[last week of month] = 1
, ALLEXCEPT('360ST','360ST'[Month], '360ST'[last week of month])
)

VAR yearIsSelected = ISFILTERED( '360ST'[year])

VAR MonthIsSelected = AND ( ISFILTERED ( '360ST'[Month]), NOT( ISFILTERED ('360ST'[year]) ) )

RETURN

SWITCH (

TRUE(),
yearIsSelected,year current orders,
MonthIsSelected, Month current orders,
Total current orders
)

 

Here is the input :

 

 

Year     MonthWeekorder number last week of month last weeek of Year
2020202010202040233  
2020202010202041101  
2020202010202042321  
20202020102020431000  
20202020102020445001 
2020202011202045233  
2020202011202046101  
2020202011202047321  
202020201120204810001 
2020202012202053260011


desired output :

 

 

YearMonthWeekcurrent orders by week current orders by month current orders by year
2020202010202040109943107236111943
2020202010202041108963107236111943
2020202010202042106643107236111943
2020202010202043110253107236111943
2020202010202044107236107236111943
2020202011202045109963106403111943
2020202011202046108112106403111943
2020202011202047109080106403111943
2020202011202048106403106403111943
2020202012202053111943111943111943


week 202044 is the last week for november 2020 so the the value for november 2020 is 107236

The value for year 2020 is the value for last week in december 2020 ( week 202053) is 111943

 

the problem with the measure that I created is :

 >>when I select month and year both, the measure get year value not month value

>> when i selected month and week both, the measure get month value not week value

 

It seems isFiltered function doesn't work

 

thanks

1 REPLY 1
littlemojopuppy
Community Champion
Community Champion

Can you provide a sample PBIX file?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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