English 中文(简体)
根据日期范围对类别名称进行分类,并在权力划分中选择许可人
原标题:Categorizing category name based on date range and slicer selection in Power BI

我有以下数据集:

数据集

“dataset”/

I wanted to write DAX code in which I haven t found the right logics for the following case below: The table of datasets above represent Subject Table with column of "Category" and "Date"

I have 2 slicer which are from Calendar and Comparison Calendar Table where Calendar table have relationship with Subject Table but the Comparison Calendar Table does not have active relationship with Subject Table. hen people select 2 dates (previous and later date) from Calendar and Comparison Calendar Table respectively in the provided slicer, then the DAX will categorize the Category Name into 3 clusters : 1)retired - when the later date does not have the category name from previous date but the previous date does have the category name 2)existing - when both the later date and previous date does have the same category name 3)new - when the later date does have the category name from previous date but the previous date does not have the category name

下面是数据模型的筛选:

“entergraph

预计结果如下:

“entergraph

问题回答

You should first update the relationships to be One-to-Many and Single direction. Should look like below:

“entergraph

Then create a new Measure with:

Cluster = 
  var d1 = CALCULATE( COUNTROWS( Subject ), REMOVEFILTERS( Comparison Calendar ) )
  var d2 = CALCULATE( COUNTROWS( Subject ), REMOVEFILTERS( Calendar ), USERELATIONSHIP( Comparison Calendar [Date],  Subject [Date]) )
  return SWITCH( TRUE(),
    d1 > 0 && ISBLANK(d2), "retired",
    d1 > 0 && d2 > 0, "existing",
    ISBLANK(d1) && d2 > 0, "new"
  )

希望这将产生以下成果:

“在此处的影像描述”/</a





相关问题
Mysql compaire two dates from datetime?

I was try to measure what is faster and what should be the best way to compare two dates, from datetime record in MySql db. There are several approaches how to grab a date from date time, but I was ...

iPhone Date Picker rolls over to 2010 on December 27th?

So I implemented a UIDatepicker in one of my applications for scheduling and autodialing teleconferences... everything is pretty much ready to go except, while testing I noticed that when the date ...

Convert date Python

I have MMDDYY dates, i.e. today is 111609 How do I convert this to 11/16/2009, in Python?

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

NSDateFormat, super simple! Where am I screwing up?

Ok, this is really simple, maybe I m a getting a bit burnt out, but seems like it should work, Query XML feed, put out date string, format, display in a cell. The issue is I m a getting a NULL ...

sqlite writing a date into an email

I am exporting a date value from sqlite and placing it into an email. The date appears like this 279498721.322872 I am using Objective C in an Iphone App. Does anyone know how to make this export ...

热门标签